tab navigation

This commit is contained in:
AlcalaJulian
2025-11-17 00:15:31 +01:00
parent 5ca37d2822
commit 4225f7510b
48 changed files with 801 additions and 231 deletions

View File

@@ -1,52 +0,0 @@
import 'package:auth/auth.dart';
import 'package:dashboard_shell/dashboard_builder.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:navigation/navigation.dart';
import 'package:get_it/get_it.dart';
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
late GoRouter appRouter;
void configureAppRouter() {
appRouter = GoRouter(
navigatorKey: navigatorKey,
initialLocation: '/login',
routes: [
GoRoute(
path: '/onboarding',
pageBuilder: (context, state) =>
OnboardingBuilder().buildPage(context, state),
),
GoRoute(
path: '/link_phone',
pageBuilder: (context, state) =>
LinkPhoneBuilder().buildPage(context, state),
),
GoRoute(
path: '/phone_code',
pageBuilder: (context, state) =>
PhoneCodeBuilder().buildPage(context, state),
),
GoRoute(
path: '/login',
pageBuilder: (context, state) =>
LoginBuilder().buildPage(context, state),
),
GoRoute(
path: '/recover_password',
pageBuilder: (context, state) =>
RecoverPasswordBuilder().buildPage(context, state),
),
GoRoute(
path: '/dashboard_shell',
pageBuilder: (context, state) =>
DashboardBuilder().buildPage(context, state),
),
],
);
GetIt.I<NavigationContract>().setRouter(appRouter);
}

View File

@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:design_system/design_system.dart';
import 'package:sf_app_platform/app_router_config.dart';
import 'package:sf_app_platform/navigation/app_router.dart';
import 'package:navigation/navigation_module.dart';
Future<void> main() async {

View File

@@ -0,0 +1,94 @@
import 'package:auth/auth.dart';
import 'package:dashboard_shell/dashboard_builder.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:home/home.dart';
import 'package:navigation/navigation.dart';
import 'package:get_it/get_it.dart';
import 'package:notifications/notifications.dart';
import 'package:profile/profile.dart';
final GlobalKey<NavigatorState> rootNavigatorKey = GlobalKey<NavigatorState>();
late final GoRouter appRouter;
void configureAppRouter() {
appRouter = GoRouter(
navigatorKey: rootNavigatorKey,
initialLocation: '/login',
// redirect: (context, state) {},
routes: [
GoRoute(
path: '/login',
name: 'login',
pageBuilder: LoginBuilder().buildPage,
),
GoRoute(
path: '/onboarding',
name: 'onboarding',
pageBuilder: OnboardingBuilder().buildPage,
),
GoRoute(
path: '/link_phone',
name: 'link_phone',
pageBuilder: LinkPhoneBuilder().buildPage,
),
GoRoute(
path: '/phone_code',
name: 'phone_code',
pageBuilder: PhoneCodeBuilder().buildPage,
),
GoRoute(
path: '/recover_password',
name: 'recover_password',
pageBuilder: RecoverPasswordBuilder().buildPage,
),
StatefulShellRoute.indexedStack(
builder: (context, state, navShell) {
return DashboardBuilder().build(context, navShell);
},
branches: [
StatefulShellBranch(
routes: [
GoRoute(
path: '/main/home',
name: 'home',
pageBuilder: const HomeBuilder().buildPage,
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: '/main/activity',
name: 'activity',
pageBuilder: const ActivityBuilder().buildPage,
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: '/main/notifications',
name: 'notifications',
pageBuilder: const NotificationsBuilder().buildPage,
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: '/main/profile',
name: 'profile',
pageBuilder: const ProfileBuilder().buildPage,
),
],
),
],
),
],
);
GetIt.I<NavigationContract>().setRouter(appRouter);
}

View File

@@ -0,0 +1,11 @@
enum AppRoutes {
onboarding,
linkPhone,
phoneCode,
login,
recoverPassword,
home,
activity,
notifications,
profile,
}