|
@@ -1,3 +1,60 @@
|
|
|
+import 'package:flutter/material.dart';
|
|
|
+import 'package:gobang/pages/home_page.dart';
|
|
|
+import 'package:gobang/pages/index_page.dart';
|
|
|
+import 'package:gobang/pages/login_page.dart';
|
|
|
+import 'package:gobang/pages/mine_page.dart';
|
|
|
+import 'package:gobang/pages/splash/splash_page.dart';
|
|
|
+
|
|
|
+/// Description: routes
|
|
|
+/// Time : 02/21/2024 Wednesday
|
|
|
+/// Author : liuyuqi.gov@msn.cn
|
|
|
class Routes {
|
|
|
static const String index = "/index";
|
|
|
+ static const String home = "/home";
|
|
|
+ static const String login = "/login";
|
|
|
+ static const String mine = "/mine";
|
|
|
+ static const String setting = "/mine/setting";
|
|
|
+ static const String pay = "/pay";
|
|
|
+ static const String splash = "/splash";
|
|
|
+
|
|
|
+ static MaterialPageRoute<dynamic> onGenerateRoute(RouteSettings settings) {
|
|
|
+ switch (settings.name) {
|
|
|
+ case home:
|
|
|
+ return MaterialPageRoute<dynamic>(
|
|
|
+ builder: (_) => HomePage(),
|
|
|
+ );
|
|
|
+ case index:
|
|
|
+ return MaterialPageRoute<dynamic>(
|
|
|
+ builder: (_) => IndexPage(),
|
|
|
+ );
|
|
|
+ case splash:
|
|
|
+ return MaterialPageRoute<dynamic>(
|
|
|
+ builder: (_) => const SpalshPage(),
|
|
|
+ );
|
|
|
+ case mine:
|
|
|
+ return MaterialPageRoute<dynamic>(
|
|
|
+ builder: (_) => const MinePage(),
|
|
|
+ );
|
|
|
+ case login:
|
|
|
+ return MaterialPageRoute<dynamic>(
|
|
|
+ builder: (_) => const LoginPage(),
|
|
|
+ );
|
|
|
+ default:
|
|
|
+ return MaterialPageRoute<dynamic>(
|
|
|
+ builder: (_) => const Scaffold(
|
|
|
+ body: Center(
|
|
|
+ child: Text("404"),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ static void popAndPushNamed(BuildContext context, String routePath) {
|
|
|
+ Navigator.popAndPushNamed(context, routePath);
|
|
|
+ }
|
|
|
+
|
|
|
+ static void pushReplacementNamed(BuildContext context, String routePath) {
|
|
|
+ Navigator.pushReplacementNamed(context, routePath);
|
|
|
+ }
|
|
|
}
|