@@ -9,54 +9,78 @@ import 'package:jusicool_ios/screens/mycapital_screens/maincapital_screen.dart';
99import 'package:jusicool_ios/screens/mycapital_screens/monthlyrevenue_screen.dart' ;
1010import 'package:jusicool_ios/screens/mycapital_screens/order_detail.dart' ;
1111
12- final GoRouter router = GoRouter (
13- initialLocation: '/splash' ,
14- routes: [
15- GoRoute (path: '/splash' , builder: (context, state) => const SplashScreen ()),
16- GoRoute (path: '/login' , builder: (context, state) => const LoginScreen ()),
17- GoRoute (
18- path: '/name-input' ,
19- builder: (context, state) => const NameInputScreen (),
20- ),
21- GoRoute (
22- path: '/email-auth' ,
23- builder: (context, state) {
24- final username = state.extra as String ? ;
25- return EmailAuthScreen (username: username ?? '' );
26- },
27- ),
28- GoRoute (
29- path: '/password-create' ,
30- builder: (context, state) {
31- final extra = state.extra as Map <String , String >? ;
32- return PasswordCreateScreen (
33- username: extra? ['username' ] ?? '' ,
34- email: extra? ['email' ] ?? '' ,
35- );
36- },
37- ),
38- GoRoute (
39- path: '/find-school' ,
40- builder: (context, state) {
41- final extra = state.extra as Map <String , String >? ;
42- return FindSchoolScreen (
43- username: extra? ['username' ] ?? '' ,
44- email: extra? ['email' ] ?? '' ,
45- password: extra? ['password' ] ?? '' ,
46- );
47- },
48- ),
49- GoRoute (
50- path: '/main-capital' ,
51- builder: (context, state) => const MainCapitalScreen (),
52- ),
53- GoRoute (
54- path: '/monthly-revenue' ,
55- builder: (context, state) => const MonthlyRevenueScreen (),
56- ),
57- GoRoute (
58- path: '/order-detail' ,
59- builder: (context, state) => const OrderDetailScreen (),
60- ),
61- ],
62- );
12+ class RoutePaths {
13+ static const String splash = '/splash' ;
14+ static const String login = '/login' ;
15+ static const String nameInput = '/name-input' ;
16+ static const String emailAuth = '/email-auth' ;
17+ static const String passwordCreate = '/password-create' ;
18+ static const String findSchool = '/find-school' ;
19+ static const String mainCapital = '/main-capital' ;
20+ static const String monthlyRevenue = '/monthly-revenue' ;
21+ static const String orderDetail = '/order-detail' ;
22+ }
23+
24+ class AppRouter {
25+ AppRouter ._internal ();
26+ static final AppRouter _instance = AppRouter ._internal ();
27+ factory AppRouter () => _instance;
28+
29+ late final GoRouter router = GoRouter (
30+ initialLocation: RoutePaths .splash,
31+ routes: [
32+ GoRoute (
33+ path: RoutePaths .splash,
34+ builder: (context, state) => const SplashScreen (),
35+ ),
36+ GoRoute (
37+ path: RoutePaths .login,
38+ builder: (context, state) => const LoginScreen (),
39+ ),
40+ GoRoute (
41+ path: RoutePaths .nameInput,
42+ builder: (context, state) => const NameInputScreen (),
43+ ),
44+ GoRoute (
45+ path: RoutePaths .emailAuth,
46+ builder: (context, state) {
47+ final username = state.extra as String ? ;
48+ return EmailAuthScreen (username: username ?? '' );
49+ },
50+ ),
51+ GoRoute (
52+ path: RoutePaths .passwordCreate,
53+ builder: (context, state) {
54+ final extra = state.extra as Map <String , String >? ;
55+ return PasswordCreateScreen (
56+ username: extra? ['username' ] ?? '' ,
57+ email: extra? ['email' ] ?? '' ,
58+ );
59+ },
60+ ),
61+ GoRoute (
62+ path: RoutePaths .findSchool,
63+ builder: (context, state) {
64+ final extra = state.extra as Map <String , String >? ;
65+ return FindSchoolScreen (
66+ username: extra? ['username' ] ?? '' ,
67+ email: extra? ['email' ] ?? '' ,
68+ password: extra? ['password' ] ?? '' ,
69+ );
70+ },
71+ ),
72+ GoRoute (
73+ path: RoutePaths .mainCapital,
74+ builder: (context, state) => const MainCapitalScreen (),
75+ ),
76+ GoRoute (
77+ path: RoutePaths .monthlyRevenue,
78+ builder: (context, state) => const MonthlyRevenueScreen (),
79+ ),
80+ GoRoute (
81+ path: RoutePaths .orderDetail,
82+ builder: (context, state) => const OrderDetailScreen (),
83+ ),
84+ ],
85+ );
86+ }
0 commit comments