Bez popisu

custom_router.dart 822B

123456789101112131415161718192021
  1. import 'package:flutter/material.dart';
  2. import 'package:userstory2translate/pages/about_page.dart';
  3. import 'package:userstory2translate/pages/home_page.dart';
  4. import 'package:userstory2translate/pages/not_found_page.dart';
  5. import 'package:userstory2translate/pages/settings_page.dart';
  6. import 'package:userstory2translate/router/route_constants.dart';
  7. class CustomRouter {
  8. static Route<dynamic> generatedRoute(RouteSettings settings) {
  9. switch (settings.name) {
  10. case homeRoute:
  11. return MaterialPageRoute(builder: (_) => HomePage());
  12. case aboutRoute:
  13. return MaterialPageRoute(builder: (_) => AboutPage());
  14. case settingsRoute:
  15. return MaterialPageRoute(builder: (_) => SettingsPage());
  16. default:
  17. return MaterialPageRoute(builder: (_) => NotFoundPage());
  18. }
  19. }
  20. }