151 lines
5.1 KiB
Dart
151 lines
5.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:nhance_partner/presentation/screens/dashboard/tabs/bussiness.dart';
|
|
import 'package:nhance_partner/presentation/screens/dashboard/tabs/chart.dart';
|
|
import 'package:nhance_partner/presentation/screens/dashboard/tabs/live.dart';
|
|
import 'package:nhance_partner/presentation/screens/dashboard/tabs/partner.dart';
|
|
import 'package:nhance_partner/presentation/screens/dashboard/tabs/productivity.dart';
|
|
import 'package:nhance_partner/presentation/screens/dashboard/tabs/stacked_BAR_Exple.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import '../../../core/responsive/responsive_builder.dart';
|
|
import '../../../core/routing/routes.dart';
|
|
import '../../../core/services/api_service.dart';
|
|
import '../../layouts/main_layout.dart';
|
|
import '../../providers/manager_provider.dart';
|
|
import '../../providers/quotation_staff_proivder.dart';
|
|
import '../../providers/userRoleProvider.dart';
|
|
import '../../themes/charts/barChart.dart';
|
|
import '../staff/Enquiry/tabs/tab.dart';
|
|
import '../staff/assignStaff.dart';
|
|
|
|
final enquiriesProvider = Provider<List<Map<String, String>>>((ref) {
|
|
return List.generate(5, (i) {
|
|
return {
|
|
"reg": "rrTN64V4387",
|
|
"Insurer": "rrNew India",
|
|
"date": "rr09/09/2025",
|
|
"time": "rr11:30 AM",
|
|
};
|
|
});
|
|
});
|
|
|
|
class Dashboard extends ConsumerStatefulWidget {
|
|
const Dashboard({super.key});
|
|
|
|
@override
|
|
ConsumerState<Dashboard> createState() => _DashboardState();
|
|
}
|
|
|
|
class _DashboardState extends ConsumerState<Dashboard>
|
|
with SingleTickerProviderStateMixin {
|
|
late TabController _tabController;
|
|
|
|
// Dynamic items (4 values)
|
|
final List<String> tabs = ["Live", "Business", "Partner", "Productivity"];
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_tabController = TabController(length: tabs.length, vsync: this);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_tabController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
final List<Color> tabColors = [
|
|
Colors.amber.shade100, // Live
|
|
// Color(0XFFF1556C), // Business
|
|
// Color(0XFF02A8B5), // Business
|
|
Colors.blue.shade100, // Business
|
|
Colors.orange.shade100, // Partner
|
|
Colors.green.shade100, // Productivity
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MainLayout(
|
|
title: "Dashboard",
|
|
body: SafeArea(
|
|
child: SelectionArea(
|
|
child:Container(
|
|
// color: Colors.amber.shade100,
|
|
child: Column(
|
|
children: [
|
|
// TabBar(
|
|
// padding: EdgeInsets.zero,
|
|
// controller: _tabController,
|
|
// isScrollable: false,
|
|
// indicatorColor: Colors.teal,
|
|
// labelColor: Colors.teal,
|
|
// unselectedLabelColor: Colors.grey,
|
|
// tabs: tabs.map((e) => Tab(text: e)).toList(),
|
|
// ),
|
|
Row(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: List.generate(tabs.length, (index) {
|
|
final isSelected = _tabController.index == index;
|
|
|
|
return GestureDetector(
|
|
onTap: () {
|
|
_tabController.animateTo(index);
|
|
setState(() {});
|
|
},
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 2,
|
|
horizontal: 10,
|
|
),
|
|
margin: EdgeInsets.only(left: 10),
|
|
decoration: BoxDecoration(
|
|
// color: isSelected ? Colors.teal : tabColors[index],
|
|
color: tabColors[index],
|
|
borderRadius: BorderRadius.circular(5),
|
|
|
|
border: Border.all(
|
|
color: isSelected ? Colors.teal : tabColors[index],
|
|
width: 1,
|
|
),
|
|
),
|
|
child: Text(
|
|
tabs[index],
|
|
style: GoogleFonts.poppins(
|
|
// color: isSelected ? Colors.white : Colors.black87,
|
|
color: Colors.black87,
|
|
fontSize: 11,
|
|
fontWeight: isSelected
|
|
? FontWeight.w500
|
|
: FontWeight.w400,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
|
|
Expanded(
|
|
child: TabBarView(
|
|
controller: _tabController,
|
|
children: [
|
|
// Text('A'),
|
|
LiveDashboard(),
|
|
BussinessDashboard(),
|
|
PartnerDashboard(),
|
|
ProductivityDashboard(),
|
|
// BarChartSample4(),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
));
|
|
}
|
|
}
|