diff --git a/lib/common/dashboard.dart b/lib/common/dashboard.dart index da337d8..b0a707b 100644 --- a/lib/common/dashboard.dart +++ b/lib/common/dashboard.dart @@ -17,6 +17,8 @@ import 'package:supplier_new/resources/fleet.dart'; import 'package:supplier_new/set_rates/set_rates.dart'; import '../login/login.dart'; +import '../resources/resources_fleet.dart'; +import '../resources/resources_main.dart'; class DashboardScreen extends StatefulWidget { const DashboardScreen({super.key}); @@ -44,7 +46,7 @@ class _DashboardScreenState extends State { HomeScreen(), AllOrders(navigationFrom: 'bottombar',), AllPlans(navigationFrom: 'bottombar',), - FleetStep1Page(), + ResourcesMainScreen(), FinancialMainScreen(), ]; // List of bottom navigation bar items diff --git a/lib/resources/availability.dart b/lib/resources/availability.dart index b556c57..e1fd76a 100644 --- a/lib/resources/availability.dart +++ b/lib/resources/availability.dart @@ -3,6 +3,8 @@ import 'package:supplier_new/common/settings.dart'; import 'package:supplier_new/resources/resources_fleet.dart'; import 'package:supplier_new/resources/source_location2.dart'; +import 'fleet.dart'; + void main() => runApp(const MaterialApp(home: AvailabilityScreen())); class AvailabilityScreen extends StatefulWidget { @@ -335,7 +337,7 @@ class _AvailabilityScreenState extends State { ), onPressed: () { // TODO: Navigate to the next step/screen - Navigator.push(context, MaterialPageRoute(builder: (_) => const ResourcesFleetScreen())); + Navigator.push(context, MaterialPageRoute(builder: (_) => const FleetStep1Page())); }, child: Text( diff --git a/lib/resources/employees.dart b/lib/resources/employees.dart index b5acede..ebc939a 100644 --- a/lib/resources/employees.dart +++ b/lib/resources/employees.dart @@ -311,11 +311,11 @@ class _FleetEmployeesState extends State { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)), ), onPressed: () { - // TODO: Navigate to the next step/screen - Navigator.push(context, MaterialPageRoute(builder: (_) => const SourceLocation())); - // ScaffoldMessenger.of(context).showSnackBar( - // SnackBar(content: Text("Saved ${_drivers.length} driver(s). Proceeding…")), - // ); + // // TODO: Navigate to the next step/screen + // Navigator.push(context, MaterialPageRoute(builder: (_) => const SourceLocation())); + // // ScaffoldMessenger.of(context).showSnackBar( + // // SnackBar(content: Text("Saved ${_drivers.length} driver(s). Proceeding…")), + // // ); }, child: Text( "Continue", diff --git a/lib/resources/fleet.dart b/lib/resources/fleet.dart index 6bcb8a8..11abb75 100644 --- a/lib/resources/fleet.dart +++ b/lib/resources/fleet.dart @@ -385,10 +385,10 @@ class _FleetStep1PageState extends State { borderRadius: BorderRadius.circular(24)), ), onPressed: () { - Navigator.push( - context, - MaterialPageRoute(builder: (_) => const FleetStep2Page()), - ); + // Navigator.push( + // context, + // MaterialPageRoute(builder: (_) => const FleetStep2Page()), + // ); }, child: Text( "Continue", diff --git a/lib/resources/fleet_1.dart b/lib/resources/fleet_1.dart index d3bf662..234f75f 100644 --- a/lib/resources/fleet_1.dart +++ b/lib/resources/fleet_1.dart @@ -144,10 +144,10 @@ class _FleetStep2PageState extends State { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)), ), onPressed: () { - Navigator.push( - context, - MaterialPageRoute(builder: (_) => const FleetEmployees()), - ); + // Navigator.push( + // context, + // MaterialPageRoute(builder: (_) => const FleetEmployees()), + // ); }, child: Text( "Continue", diff --git a/lib/resources/resources_drivers.dart b/lib/resources/resources_drivers.dart index dee7342..033ad47 100644 --- a/lib/resources/resources_drivers.dart +++ b/lib/resources/resources_drivers.dart @@ -42,67 +42,8 @@ class _ResourcesDriverScreenState extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, - appBar: AppBar( - backgroundColor: Colors.white, - elevation: 0.7, - leading: IconButton( - icon: const Icon(Icons.arrow_back, color: Colors.black87), - onPressed: () => Navigator.of(context).maybePop(), - ), - title: Text( - 'Resources', - style: fontTextStyle(16, Color(0xFF2A2A2A), FontWeight.w600), - ), - actions: [ - TextButton( - onPressed: () {}, - child: Text( - 'HELP', - style: fontTextStyle(12, Color(0xFF8270DB), FontWeight.w600), - ), - ), - ], - ), body: Column( children: [ - // Segmented pill - Container( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: Row( - children: List.generate(3, (i) { - final labels = ['Fleet', 'Drivers', 'Sources']; - final isSelected = selectedTab == i; - return Expanded( - child: GestureDetector( - onTap: () => setState(() => selectedTab = i), - child: Container( - padding: const EdgeInsets.symmetric(vertical: 8), - margin: const EdgeInsets.symmetric(horizontal: 4), - decoration: BoxDecoration( - color: isSelected - ? const Color(0xFFF1F1F1) - : Colors.transparent, - borderRadius: BorderRadius.circular(20), - ), - alignment: Alignment.center, - child: Text( - labels[i], - style: TextStyle( - color: isSelected - ? const Color(0xFF101214) - : const Color(0xFF646464), - fontWeight: - isSelected ? FontWeight.w600 : FontWeight.w500, - ), - ), - ), - ), - ); - }), - ), - ), - - // Total Drivers card Container( margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), padding: const EdgeInsets.all(14), @@ -252,7 +193,7 @@ class _ResourcesDriverScreenState extends State { floatingActionButton: FloatingActionButton( onPressed: () { // TODO: Navigate to the next step/screen - Navigator.push(context, MaterialPageRoute(builder: (_) => FleetEmployees())); + // Navigator.push(context, MaterialPageRoute(builder: (_) => FleetEmployees())); }, backgroundColor: Colors.black, diff --git a/lib/resources/resources_fleet.dart b/lib/resources/resources_fleet.dart index c87ebef..05d08b4 100644 --- a/lib/resources/resources_fleet.dart +++ b/lib/resources/resources_fleet.dart @@ -72,27 +72,6 @@ class _ResourcesFleetScreenState extends State { return Scaffold( backgroundColor: Colors.white, - appBar: AppBar( - backgroundColor: Colors.white, - elevation: 0.7, - leading: IconButton( - icon: const Icon(Icons.arrow_back, color: Colors.black87), - onPressed: () => Navigator.of(context).maybePop(), - ), - title: Text( - 'Resources', - style: fontTextStyle(16, const Color(0xFF2A2A2A), FontWeight.w600), - ), - centerTitle: false, - actions: [ - TextButton( - onPressed: () {}, - child: Text('HELP', - style: fontTextStyle( - 12, const Color(0xFF8270DB), FontWeight.w600)), - ), - ], - ), body: Column( children: [ Container( @@ -100,44 +79,6 @@ class _ResourcesFleetScreenState extends State { padding: const EdgeInsets.fromLTRB(16, 12, 16, 12), child: Column( children: [ - // Segmented pill - Container( - padding: const EdgeInsets.all(6), - child: Row( - children: List.generate(3, (i) { - final labels = ['Fleet', 'Drivers', 'Sources']; - final isSelected = selectedTab == i; - return Expanded( - child: GestureDetector( - onTap: () => setState(() => selectedTab = i), - child: Container( - padding: const EdgeInsets.symmetric(vertical: 8), - margin: const EdgeInsets.symmetric(horizontal: 4), - decoration: BoxDecoration( - color: isSelected - ? const Color(0xFFF1F1F1) - : Colors.transparent, - borderRadius: BorderRadius.circular(20), - ), - alignment: Alignment.center, - child: Text( - labels[i], - style: TextStyle( - color: isSelected - ? const Color(0xFF101214) - : const Color(0xFF646464), - fontWeight: isSelected - ? FontWeight.w600 - : FontWeight.w500, - ), - ), - ), - ), - ); - }), - ), - ), - const SizedBox(height: 12), Container( width: double.infinity, @@ -319,7 +260,7 @@ class _ResourcesFleetScreenState extends State { floatingActionButton: FloatingActionButton( onPressed: () { // TODO: Navigate to the next step/screen - Navigator.push(context, MaterialPageRoute(builder: (_) => const FleetStep1Page())); + // Navigator.push(context, MaterialPageRoute(builder: (_) => const FleetStep1Page())); }, backgroundColor: const Color(0xFF000000), diff --git a/lib/resources/resources_main.dart b/lib/resources/resources_main.dart new file mode 100644 index 0000000..765a64d --- /dev/null +++ b/lib/resources/resources_main.dart @@ -0,0 +1,175 @@ +import 'package:flutter/material.dart'; +import 'package:supplier_new/resources/resources_fleet.dart'; +import 'package:supplier_new/resources/resources_drivers.dart'; +import 'package:supplier_new/resources/resources_sources.dart'; +import 'package:supplier_new/resources/source_location.dart'; +import '../common/settings.dart'; +import 'employees.dart'; +import 'fleet.dart'; + +void main() => runApp(const MaterialApp( + debugShowCheckedModeBanner: false, + home: ResourcesMainScreen(), + )); + +class ResourcesMainScreen extends StatefulWidget { + const ResourcesMainScreen({super.key}); + + @override + State createState() => _ResourcesMainScreenState(); +} + +class _ResourcesMainScreenState extends State + with SingleTickerProviderStateMixin { + late TabController _tabController; + final List _labels = const ['Fleet', 'Drivers', 'Sources']; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: _labels.length, vsync: this); + } + + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + + // FAB per tab + Widget? _buildFAB(int index) { + switch (index) { + case 0: // Fleet + return FloatingActionButton( + heroTag: null, + backgroundColor: Colors.black, + child: const Icon(Icons.add, color: Colors.white), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => const HeroMode( + enabled: false, + child: FleetStep1Page(), + ), + ), + ); + }, + ); + + case 1: // Drivers + return FloatingActionButton( + heroTag: null, + backgroundColor: Colors.black, + child: const Icon(Icons.add, color: Colors.white), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => const HeroMode( + enabled: false, + child: FleetEmployees(), + ), + ), + ); + }, + ); + + case 2: // Sources + return FloatingActionButton( + heroTag: null, + backgroundColor: Colors.black, + child: const Icon(Icons.add, color: Colors.white), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => const HeroMode( + enabled: false, + child: SourceLocation(), + ), + ), + ); + }, + ); + + default: + return null; + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + // keep entire screen white + backgroundColor: Colors.white, + body: SafeArea( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + child: AnimatedBuilder( + animation: _tabController, + builder: (context, _) { + return Row( + children: List.generate(_labels.length, (index) { + final isSelected = _tabController.index == index; + return Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => + setState(() => _tabController.index = index), + child: AnimatedContainer( + duration: const Duration(milliseconds: 180), + curve: Curves.easeInOut, + margin: const EdgeInsets.symmetric(horizontal: 6), + padding: const EdgeInsets.symmetric(vertical: 10), + decoration: BoxDecoration( + color: isSelected + ? const Color(0xFFF1F1F1) + : Colors.white, + borderRadius: + BorderRadius.circular(16), // radius 16 always + ), + alignment: Alignment.center, + child: Text( + _labels[index], + style: fontTextStyle( + 12, + isSelected ? const Color(0xFF101214) : const Color(0xFF646464), + isSelected ? FontWeight.w700 : FontWeight.w400, + ), + ), + ), + ), + ); + }), + ); + }, + ), + ), + const SizedBox(height: 8), + Expanded( + child: HeroMode( + enabled: false, + child: TabBarView( + controller: _tabController, + children: const [ + ResourcesFleetScreen(), + ResourcesDriverScreen(), + ResourcesSourceScreen(), + ], + ), + ), + ), + ], + ), + ), + floatingActionButton: AnimatedBuilder( + animation: _tabController.animation!, + builder: (context, _) => + _buildFAB(_tabController.index) ?? const SizedBox.shrink(), + ), + ); + } +} diff --git a/lib/resources/resources_sources.dart b/lib/resources/resources_sources.dart index 6ccba8b..66c26d1 100644 --- a/lib/resources/resources_sources.dart +++ b/lib/resources/resources_sources.dart @@ -54,27 +54,7 @@ class _ResourcesSourceScreenState extends State { return Scaffold( backgroundColor: Colors.white, - appBar: AppBar( - backgroundColor: Colors.white, - elevation: 0.7, - leading: IconButton( - icon: const Icon(Icons.arrow_back, color: Colors.black87), - onPressed: () => Navigator.of(context).maybePop(), - ), - title: Text( - 'Resources', - style: fontTextStyle(16, const Color(0xFF2A2A2A), FontWeight.w600), - ), - centerTitle: false, - actions: [ - TextButton( - onPressed: () {}, - child: Text('HELP', - style: fontTextStyle( - 12, const Color(0xFF8270DB), FontWeight.w600)), - ), - ], - ), + body: Column( children: [ // Top card section @@ -83,44 +63,6 @@ class _ResourcesSourceScreenState extends State { padding: const EdgeInsets.fromLTRB(16, 12, 16, 12), child: Column( children: [ - // Segmented pill - Container( - padding: const EdgeInsets.all(6), - child: Row( - children: List.generate(3, (i) { - final labels = ['Fleet', 'Drivers', 'Sources']; - final isSelected = selectedTab == i; - return Expanded( - child: GestureDetector( - onTap: () => setState(() => selectedTab = i), - child: Container( - padding: const EdgeInsets.symmetric(vertical: 8), - margin: const EdgeInsets.symmetric(horizontal: 4), - decoration: BoxDecoration( - color: isSelected - ? const Color(0xFFF1F1F1) - : Colors.transparent, - borderRadius: BorderRadius.circular(20), - ), - alignment: Alignment.center, - child: Text( - labels[i], - style: TextStyle( - color: isSelected - ? const Color(0xFF101214) - : const Color(0xFF646464), - fontWeight: isSelected - ? FontWeight.w600 - : FontWeight.w500, - ), - ), - ), - ), - ); - }), - ), - ), - const SizedBox(height: 12), // Total Source Locations card Container( @@ -293,7 +235,7 @@ class _ResourcesSourceScreenState extends State { floatingActionButton: FloatingActionButton( onPressed: () { // TODO: Navigate to the next step/screen - Navigator.push(context, MaterialPageRoute(builder: (_) => const SourceLocation())); + // Navigator.push(context, MaterialPageRoute(builder: (_) => const SourceLocation())); }, backgroundColor: const Color(0xFF000000), diff --git a/lib/resources/source_location.dart b/lib/resources/source_location.dart index b17b8df..e50c742 100644 --- a/lib/resources/source_location.dart +++ b/lib/resources/source_location.dart @@ -320,11 +320,11 @@ class _SourceLocationState extends State { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)), ), onPressed: () { - // TODO: Navigate to the next step/screen - Navigator.push(context, MaterialPageRoute(builder: (_) => const SourceLocation1())); - // ScaffoldMessenger.of(context).showSnackBar( - // SnackBar(content: Text("Saved ${_drivers.length} driver(s). Proceeding…")), - // ); + // // TODO: Navigate to the next step/screen + // Navigator.push(context, MaterialPageRoute(builder: (_) => const SourceLocation1())); + // // ScaffoldMessenger.of(context).showSnackBar( + // // SnackBar(content: Text("Saved ${_drivers.length} driver(s). Proceeding…")), + // // ); }, child: Text( "Continue", diff --git a/lib/resources/source_location1.dart b/lib/resources/source_location1.dart index 060cbb3..c673979 100644 --- a/lib/resources/source_location1.dart +++ b/lib/resources/source_location1.dart @@ -291,7 +291,7 @@ class _SourceLocation1State extends State { ), onPressed: () { // TODO: Navigate to the next step/screen - Navigator.push(context, MaterialPageRoute(builder: (_) => const SourceLocation2())); + // Navigator.push(context, MaterialPageRoute(builder: (_) => const SourceLocation2())); // ScaffoldMessenger.of(context).showSnackBar( // SnackBar(content: Text("Saved ${_drivers.length} driver(s). Proceeding…")), // ); diff --git a/lib/resources/source_location2.dart b/lib/resources/source_location2.dart index 56e3aea..4da50e0 100644 --- a/lib/resources/source_location2.dart +++ b/lib/resources/source_location2.dart @@ -344,7 +344,7 @@ class _SourceLocation2State extends State { ), onPressed: () { // TODO: Navigate to the next step/screen - Navigator.push(context, MaterialPageRoute(builder: (_) => const AvailabilityScreen())); + // Navigator.push(context, MaterialPageRoute(builder: (_) => const AvailabilityScreen())); // ScaffoldMessenger.of(context).showSnackBar( // SnackBar(content: Text("Saved ${_drivers.length} driver(s). Proceeding…")), // );