routes.dart 2.3 KB

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