routes.dart 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_tracker/index_page.dart';
  4. import 'package:flutter_tracker/pages/about_page.dart';
  5. import 'package:flutter_tracker/pages/help_page.dart';
  6. import 'package:flutter_tracker/pages/login_page.dart';
  7. import 'package:flutter_tracker/pages/mine_page.dart';
  8. import 'package:flutter_tracker/pages/register_page.dart';
  9. import 'package:flutter_tracker/pages/submit_page.dart';
  10. import 'package:flutter_tracker/pages/track_page.dart';
  11. import 'package:flutter_tracker/pages/welcome_page.dart';
  12. /// Description:
  13. /// Time : 2021年12月03日 Friday
  14. /// Author : liuyuqi.gov@msncn
  15. class Routes {
  16. static const String indexPage = "/index";
  17. static const String trackPage = '/track';
  18. static const String minePage = '/mine';
  19. static const String aboutPage = '/about_me';
  20. static const String helpPage = '/help';
  21. static const String loginPage = '/login';
  22. static const String registerPage = '/register';
  23. static const String submitPage = '/submit';
  24. static const String welPage = '/welcome';
  25. static Route<dynamic> generateRoute(RouteSettings settings) {
  26. switch (settings.name) {
  27. case indexPage:
  28. return MaterialPageRoute(builder: (_) => IndexPage());
  29. break;
  30. case trackPage:
  31. return MaterialPageRoute(builder: (_) => TrackPage());
  32. break;
  33. case minePage:
  34. return MaterialPageRoute(builder: (_) => MinePage());
  35. break;
  36. case aboutPage:
  37. return MaterialPageRoute(builder: (_) => AboutPage());
  38. break;
  39. case helpPage:
  40. return MaterialPageRoute(builder: (_) => HelpPage());
  41. break;
  42. case loginPage:
  43. return MaterialPageRoute(builder: (_) => LoginPage());
  44. break;
  45. case registerPage:
  46. return MaterialPageRoute(builder: (_) => RegisterPage());
  47. break;
  48. case submitPage:
  49. return MaterialPageRoute(builder: (_) => SubmitPage());
  50. break;
  51. case welPage:
  52. return MaterialPageRoute(builder: (_) => WelComePage());
  53. break;
  54. default:
  55. return MaterialPageRoute(
  56. builder: (_) => Scaffold(
  57. appBar: AppBar(title: Text("Route Error")),
  58. body: Center(
  59. child: Text('No route defined for ${settings.name}'),
  60. ),
  61. ));
  62. }
  63. }
  64. }