routes.dart 773 B

1234567891011121314151617181920212223242526272829
  1. import 'package:flutter/material.dart';
  2. /// Description: routes
  3. /// Time : 09/03/2023 Sunday
  4. /// Author : liuyuqi.gov@msn.cn
  5. class Routes {
  6. static const String home = '/';
  7. static const String index = '/index';
  8. static const String login = '/login';
  9. static MaterialPageRoute<dynamic> generateRoute(RouteSettings settings) {
  10. switch (settings.name) {
  11. case home:
  12. return MaterialPageRoute<dynamic>(
  13. builder: (_) => const Scaffold(),
  14. settings: settings,
  15. );
  16. default:
  17. return MaterialPageRoute<dynamic>(
  18. builder: (_) => const Scaffold(),
  19. settings: settings,
  20. );
  21. }
  22. }
  23. void go(BuildContext context, String routeName) {
  24. Navigator.pushNamed(context, routeName);
  25. }
  26. }