Nav apraksta

custom_router.dart 697B

123456789101112131415161718192021
  1. import 'package:flutter/material.dart';
  2. import '../pages/about_page.dart';
  3. import '../pages/home_page.dart';
  4. import '../pages/not_found_page.dart';
  5. import '../pages/settings_page.dart';
  6. import '../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. }