- create auth, main shell, home, profile, notifications and settings modules.
- added navigation, utils, design system and shared packages - implemented go router in entiered app - implemented flutter riverpod instead provider
This commit is contained in:
52
apps/mobile_app/lib/app_router_config.dart
Normal file
52
apps/mobile_app/lib/app_router_config.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
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);
|
||||
}
|
||||
30
apps/mobile_app/lib/main.dart
Normal file
30
apps/mobile_app/lib/main.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
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:navigation/navigation_module.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
navigationModule();
|
||||
configureAppRouter();
|
||||
themePackages();
|
||||
|
||||
runApp(const ProviderScope(child: PlatformApp()));
|
||||
}
|
||||
|
||||
class PlatformApp extends ConsumerWidget {
|
||||
const PlatformApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return MaterialApp.router(
|
||||
title: 'SaveFamily',
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Color(0xFF329E95)),
|
||||
),
|
||||
routerConfig: appRouter,
|
||||
debugShowCheckedModeBanner: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user