diff --git a/lib/pages/tabs/home_page.dart b/lib/pages/tabs/home_page.dart new file mode 100644 index 00000000..f720260f --- /dev/null +++ b/lib/pages/tabs/home_page.dart @@ -0,0 +1,58 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:flutter/material.dart'; +import 'package:sail_ui/sail_ui.dart'; +import 'package:sail_ui/theme/theme.dart'; +import 'package:sidesail/routing/router.dart'; + +@RoutePage() +class HomePage extends StatelessWidget { + const HomePage({super.key}); + + @override + Widget build(BuildContext context) { + final theme = SailTheme.of(context); + + return AutoTabsRouter.pageView( + homeIndex: 1, + routes: const [ + DashboardTabRoute(), + WithdrawalBundleTabRoute(), + WithdrawalTabRoute(), + ], + builder: (context, child, _) { + final tabsRouter = AutoTabsRouter.of(context); + return Scaffold( + body: child, + bottomNavigationBar: BottomNavigationBar( + selectedItemColor: theme.colors.orange, + currentIndex: tabsRouter.activeIndex, + onTap: tabsRouter.setActiveIndex, + items: [ + BottomNavigationBarItem( + label: 'Dashboard', + icon: SailSVG.icon( + SailSVGAsset.iconDashboardTab, + isHighlighted: tabsRouter.activeIndex == 0, + ), + ), + BottomNavigationBarItem( + label: 'Withdrawal Bundles', + icon: SailSVG.icon( + SailSVGAsset.iconDashboardTab, + isHighlighted: tabsRouter.activeIndex == 1, + ), + ), + BottomNavigationBarItem( + label: 'Withdrawals', + icon: SailSVG.icon( + SailSVGAsset.iconDashboardTab, + isHighlighted: tabsRouter.activeIndex == 2, + ), + ), + ], + ), + ); + }, + ); + } +} diff --git a/lib/routing/router.dart b/lib/routing/router.dart index 39290917..55a5f584 100644 --- a/lib/routing/router.dart +++ b/lib/routing/router.dart @@ -1,6 +1,7 @@ import 'package:auto_route/auto_route.dart'; import 'package:flutter/widgets.dart'; import 'package:sidesail/pages/tabs/dashboard_tab_page.dart'; +import 'package:sidesail/pages/tabs/home_page.dart'; import 'package:sidesail/pages/tabs/withdrawal_bundle_tab_page.dart'; import 'package:sidesail/pages/tabs/withdrawal_tab_page.dart'; import 'package:sidesail/pages/test_page.dart'; @@ -26,14 +27,20 @@ class AppRouter extends _$AppRouter { @override List get routes => [ AutoRoute( - page: DashboardTabRoute.page, + page: HomeRoute.page, initial: true, - ), - AutoRoute( - page: WithdrawalBundleTabRoute.page, - ), - AutoRoute( - page: WithdrawalTabRoute.page, + children: [ + AutoRoute( + page: DashboardTabRoute.page, + initial: true, + ), + AutoRoute( + page: WithdrawalBundleTabRoute.page, + ), + AutoRoute( + page: WithdrawalTabRoute.page, + ), + ], ), /// This route is used in tests so that we can pump a widget into a route diff --git a/lib/routing/router.gr.dart b/lib/routing/router.gr.dart index 4236e25c..e75e7958 100644 --- a/lib/routing/router.gr.dart +++ b/lib/routing/router.gr.dart @@ -15,6 +15,12 @@ abstract class _$AppRouter extends RootStackRouter { @override final Map pagesMap = { + DashboardTabRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const DashboardTabPage(), + ); + }, HomeRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, @@ -31,21 +37,35 @@ abstract class _$AppRouter extends RootStackRouter { ), ); }, - WithdrawalBundleRoute.name: (routeData) { + WithdrawalBundleTabRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const WithdrawalBundlePage(), + child: const WithdrawalBundleTabPage(), ); }, - WithdrawalRoute.name: (routeData) { + WithdrawalTabRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const WithdrawalPage(), + child: const WithdrawalTabPage(), ); }, }; } +/// generated route for +/// [DashboardTabPage] +class DashboardTabRoute extends PageRouteInfo { + const DashboardTabRoute({List? children}) + : super( + DashboardTabRoute.name, + initialChildren: children, + ); + + static const String name = 'DashboardTabRoute'; + + static const PageInfo page = PageInfo(name); +} + /// generated route for /// [HomePage] class HomeRoute extends PageRouteInfo { @@ -98,29 +118,29 @@ class SailTestRouteArgs { } /// generated route for -/// [WithdrawalBundlePage] -class WithdrawalBundleRoute extends PageRouteInfo { - const WithdrawalBundleRoute({List? children}) +/// [WithdrawalBundleTabPage] +class WithdrawalBundleTabRoute extends PageRouteInfo { + const WithdrawalBundleTabRoute({List? children}) : super( - WithdrawalBundleRoute.name, + WithdrawalBundleTabRoute.name, initialChildren: children, ); - static const String name = 'WithdrawalBundleRoute'; + static const String name = 'WithdrawalBundleTabRoute'; static const PageInfo page = PageInfo(name); } /// generated route for -/// [WithdrawalPage] -class WithdrawalRoute extends PageRouteInfo { - const WithdrawalRoute({List? children}) +/// [WithdrawalTabPage] +class WithdrawalTabRoute extends PageRouteInfo { + const WithdrawalTabRoute({List? children}) : super( - WithdrawalRoute.name, + WithdrawalTabRoute.name, initialChildren: children, ); - static const String name = 'WithdrawalRoute'; + static const String name = 'WithdrawalTabRoute'; static const PageInfo page = PageInfo(name); } diff --git a/packages/sail_ui/assets/svgs/icon_dashboard_tab.svg b/packages/sail_ui/assets/svgs/icon_dashboard_tab.svg new file mode 100644 index 00000000..e80f9419 --- /dev/null +++ b/packages/sail_ui/assets/svgs/icon_dashboard_tab.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/test/widget_test.dart b/test/widget_test.dart index 79708bc2..a92d8053 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -6,7 +6,7 @@ // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter_test/flutter_test.dart'; -import 'package:sidesail/pages/tabs/home_page.dart'; +import 'package:sidesail/pages/tabs/dashboard_tab_page.dart'; import 'test_utils.dart'; @@ -14,7 +14,7 @@ void main() { testWidgets('RPC submit smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpSailPage( - const HomePage(), + const DashboardTabPage(), ); // Verify that there's a submit button.