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 onGenerateRoute(RouteSettings settings) { switch (settings.name) { case home: return MaterialPageRoute( builder: (_) => HomePage(), ); case index: return MaterialPageRoute( builder: (_) => IndexPage(), ); case splash: return MaterialPageRoute( builder: (_) => const SpalshPage(), ); case mine: return MaterialPageRoute( builder: (_) => const MinePage(), ); case login: return MaterialPageRoute( builder: (_) => const LoginPage(), ); default: return MaterialPageRoute( 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); } }