Blame view

lib/route/route.dart 5.54 KB
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';
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
4
  import 'package:wow_english/common/pages/wow_web_page.dart';
4b358e22   liangchengyou   feat:调整文件结构
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  import 'package:wow_english/pages/home/home_page.dart';
  import 'package:wow_english/pages/lessons/lesson_page.dart';
  import 'package:wow_english/pages/listen/listen_page.dart';
  import 'package:wow_english/pages/login/forgetpwd/forget_password_home_page.dart';
  import 'package:wow_english/pages/login/loginpage/login_page.dart';
  import 'package:wow_english/pages/login/setpwd/set_pwd_page.dart';
  import 'package:wow_english/pages/practice/chosetopic/topicpicture/topic_picture_page.dart';
  import 'package:wow_english/pages/practice/chosetopic/topicword/topic_word_page.dart';
  import 'package:wow_english/pages/practice/voicetopic/voicepicture/voice_pic_page.dart';
  import 'package:wow_english/pages/practice/voicetopic/voiceword/voice_word_page.dart';
  import 'package:wow_english/pages/repeatafter/repeat_after_page.dart';
  import 'package:wow_english/pages/shop/exchane/exchange_lesson_page.dart';
  import 'package:wow_english/pages/shop/exchangelist/exchange_lesson_list_page.dart';
  import 'package:wow_english/pages/shop/home/shop_home_page.dart';
  import 'package:wow_english/pages/tab/tab_page.dart';
  import 'package:wow_english/pages/user/user_page.dart';
  import 'package:wow_english/pages/video/lookvideo/look_video_page.dart';
  import 'package:wow_english/pages/voiceanswer/voice_answer_page.dart';
  
2a29701f   liangchengyou   feat:提交代码
24
25
26
  class AppRouteName {
    static const String splash = 'splash';
    static const String login = 'login';
95edef4f   liangchengyou   feat:更新适配代码
27
    static const String home = 'home';
4bf67b91   liangchengyou   feat:设置密码
28
    static const String fogPwd = 'fogPwd';
1d5315dd   liangchengyou   feat:添加字体,调整文件结构
29
    static const String setPwd = 'setPwd';
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
30
    static const String webView = 'webView';
60e47f7c   liangchengyou   feat:课程选择功能
31
    static const String lesson = 'lesson';
d35a4e87   liangchengyou   feat:磨耳朵功能UI
32
    static const String listen = 'listen';
d1d32220   liangchengyou   feat:兑换课程+购买记录
33
34
35
    static const String shop = 'shop';
    static const String exLesson = 'exLesson';
    static const String exList = 'exList';
9d080046   liangchengyou   feat:视频跟读逻辑
36
    static const String reAfter = 'reAfter';
624214d0   liangchengyou   feat:看题选字/选图UI和部分逻辑
37
38
    static const String topicPic = 'topicPic';
    static const String topicWord = 'topicWord';
95e3448c   liangchengyou   feat:听音选图/选字
39
40
    static const String voicePic = 'voicePic';
    static const String voiceWord = 'voiceWord';
725dc3f2   liangchengyou   feat:语音问答界面UI
41
    static const String voiceAnswer = 'voiceAnswer';
22b7d4da   Key   feat: user, api path
42
    static const String user = 'user';
119ba920   liangchengyou   feat:视频播放器
43
    static const String lookVideo = 'lookVideo';
2a29701f   liangchengyou   feat:提交代码
44
45
46
47
48
    static const String tab = '/';
  }
  
  class AppRouter {
    static final navigatorKey = GlobalKey<NavigatorState>();
94342c3f   Key   feat: user util
49
  
2a29701f   liangchengyou   feat:提交代码
50
51
    // App 根节点Context
    static BuildContext get context => navigatorKey.currentContext!;
22b7d4da   Key   feat: user, api path
52
  
2a29701f   liangchengyou   feat:提交代码
53
54
55
56
57
    static Route<dynamic> generateRoute(RouteSettings settings) {
      switch (settings.name) {
        case AppRouteName.splash:
          return PageRouteBuilder(
              opaque: false,
94342c3f   Key   feat: user util
58
              pageBuilder: (_, __, ___) => const SplashPage(),
2a29701f   liangchengyou   feat:提交代码
59
60
61
              transitionDuration: Duration.zero,
              transitionsBuilder: (_, __, ___, child) => child);
        case AppRouteName.login:
94342c3f   Key   feat: user util
62
          return CupertinoPageRoute(builder: (_) => const LoginPage());
95edef4f   liangchengyou   feat:更新适配代码
63
        case AppRouteName.home:
94342c3f   Key   feat: user util
64
          return CupertinoPageRoute(builder: (_) => const HomePage());
4bf67b91   liangchengyou   feat:设置密码
65
        case AppRouteName.fogPwd:
94342c3f   Key   feat: user util
66
          return CupertinoPageRoute(builder: (_) => const ForgetPasswordHomePage());
60e47f7c   liangchengyou   feat:课程选择功能
67
        case AppRouteName.lesson:
94342c3f   Key   feat: user util
68
          return CupertinoPageRoute(builder: (_) => const LessonPage());
d35a4e87   liangchengyou   feat:磨耳朵功能UI
69
        case AppRouteName.listen:
94342c3f   Key   feat: user util
70
          return CupertinoPageRoute(builder: (_) => const ListenPage());
d1d32220   liangchengyou   feat:兑换课程+购买记录
71
        case AppRouteName.shop:
94342c3f   Key   feat: user util
72
          return CupertinoPageRoute(builder: (_) => const ShopHomePage());
d1d32220   liangchengyou   feat:兑换课程+购买记录
73
        case AppRouteName.exLesson:
94342c3f   Key   feat: user util
74
          return CupertinoPageRoute(builder: (_) => const ExchangeLessonPage());
d1d32220   liangchengyou   feat:兑换课程+购买记录
75
        case AppRouteName.exList:
94342c3f   Key   feat: user util
76
          return CupertinoPageRoute(builder: (_) => const ExchangeLessonListPage());
9d080046   liangchengyou   feat:视频跟读逻辑
77
        case AppRouteName.reAfter:
94342c3f   Key   feat: user util
78
          return CupertinoPageRoute(builder: (_) => const RepeatAfterPage());
22b7d4da   Key   feat: user, api path
79
        case AppRouteName.user:
94342c3f   Key   feat: user util
80
          return CupertinoPageRoute(builder: (_) => const UserPage());
624214d0   liangchengyou   feat:看题选字/选图UI和部分逻辑
81
        case AppRouteName.topicPic:
94342c3f   Key   feat: user util
82
          return CupertinoPageRoute(builder: (_) => const TopicPicturePage());
624214d0   liangchengyou   feat:看题选字/选图UI和部分逻辑
83
        case AppRouteName.topicWord:
94342c3f   Key   feat: user util
84
          return CupertinoPageRoute(builder: (_) => const TopicWordPage());
95e3448c   liangchengyou   feat:听音选图/选字
85
        case AppRouteName.voicePic:
94342c3f   Key   feat: user util
86
          return CupertinoPageRoute(builder: (_) => const VoicePicPage());
95e3448c   liangchengyou   feat:听音选图/选字
87
        case AppRouteName.voiceWord:
94342c3f   Key   feat: user util
88
          return CupertinoPageRoute(builder: (_) => const VoiceWordPage());
725dc3f2   liangchengyou   feat:语音问答界面UI
89
        case AppRouteName.voiceAnswer:
94342c3f   Key   feat: user util
90
          return CupertinoPageRoute(builder: (_) => const VoiceAnswerPage());
119ba920   liangchengyou   feat:视频播放器
91
        case AppRouteName.lookVideo:
94342c3f   Key   feat: user util
92
          return CupertinoPageRoute(builder: (_) => const LookVideoPage());
1d5315dd   liangchengyou   feat:添加字体,调整文件结构
93
        case AppRouteName.setPwd:
4bf67b91   liangchengyou   feat:设置密码
94
          final phoneNum = (settings.arguments as Map)['phoneNumber'] as String;
94342c3f   Key   feat: user util
95
          return CupertinoPageRoute(builder: (_) => SetPassWordPage(phoneNum: phoneNum));
bfb40cd0   liangchengyou   feat:忘记密码获取验证码
96
97
98
        case AppRouteName.webView:
          final urlStr = (settings.arguments as Map)['urlStr'] as String;
          final webViewTitle = (settings.arguments as Map)['webViewTitle'] as String;
94342c3f   Key   feat: user util
99
100
101
102
103
          return CupertinoPageRoute(
              builder: (_) => WowWebViewPage(
                    urlStr: urlStr,
                    webViewTitle: webViewTitle,
                  ));
2a29701f   liangchengyou   feat:提交代码
104
105
106
107
108
        case AppRouteName.tab:
          return PageRouteBuilder(
              opaque: false,
              settings: const RouteSettings(name: AppRouteName.tab),
              transitionDuration: Duration.zero,
94342c3f   Key   feat: user util
109
              pageBuilder: (_, __, ___) => const TabPage(),
2a29701f   liangchengyou   feat:提交代码
110
111
112
              transitionsBuilder: (_, __, ___, child) => child);
        default:
          return CupertinoPageRoute(
94342c3f   Key   feat: user util
113
              builder: (_) => Scaffold(body: Center(child: Text('No route defined for ${settings.name}'))));
2a29701f   liangchengyou   feat:提交代码
114
115
      }
    }
22b7d4da   Key   feat: user, api path
116
  }