2a29701f
liangchengyou
feat:提交代码
|
1
2
|
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
|
a117a5a3
liangchengyou
feat:更新代码
|
3
|
import 'package:wow_english/app/splash_page.dart';
|
95edef4f
liangchengyou
feat:更新适配代码
|
4
|
import 'package:wow_english/home/home_page.dart';
|
2a29701f
liangchengyou
feat:提交代码
|
5
6
7
8
9
10
11
|
import 'package:wow_english/login/login_page.dart';
import 'package:wow_english/tab/tab_page.dart';
class AppRouteName {
static const String splash = 'splash';
static const String login = 'login';
|
95edef4f
liangchengyou
feat:更新适配代码
|
12
|
static const String home = 'home';
|
2a29701f
liangchengyou
feat:提交代码
|
13
14
15
16
17
18
19
20
21
22
23
24
25
|
static const String tab = '/';
}
class AppRouter {
static final navigatorKey = GlobalKey<NavigatorState>();
// App 根节点Context
static BuildContext get context => navigatorKey.currentContext!;
static Route<dynamic> generateRoute(RouteSettings settings) {
switch (settings.name) {
case AppRouteName.splash:
return PageRouteBuilder(
opaque: false,
|
a117a5a3
liangchengyou
feat:更新代码
|
26
|
pageBuilder: (_,__,___) => const SplashPage(),
|
2a29701f
liangchengyou
feat:提交代码
|
27
28
29
|
transitionDuration: Duration.zero,
transitionsBuilder: (_, __, ___, child) => child);
case AppRouteName.login:
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
30
|
return CupertinoPageRoute(builder: (_) => const LoginPage());
|
95edef4f
liangchengyou
feat:更新适配代码
|
31
32
|
case AppRouteName.home:
return CupertinoPageRoute(builder: (_) => const HomePage());
|
2a29701f
liangchengyou
feat:提交代码
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
case AppRouteName.tab:
return PageRouteBuilder(
opaque: false,
settings: const RouteSettings(name: AppRouteName.tab),
transitionDuration: Duration.zero,
pageBuilder: (_,__,___) => const TabPage(),
transitionsBuilder: (_, __, ___, child) => child);
default:
return CupertinoPageRoute(
builder: (_) => Scaffold(
body: Center(
child: Text('No route defined for ${settings.name}'))));
}
}
}
|