Created
August 25, 2019 01:38
-
-
Save md-weber/423e0de8f12bb7ab8f139cb65785eba7 to your computer and use it in GitHub Desktop.
Router of my Flutter App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:client/paths.dart'; | |
import 'package:client/ui/pages/home.page.dart'; | |
import 'package:client/ui/pages/login.page.dart'; | |
import 'package:client/ui/pages/register.page.dart'; | |
import 'package:flutter_web/material.dart'; | |
class Router { | |
static Route<dynamic> generateRoute(RouteSettings settings) { | |
switch (settings.name) { | |
case RoutePaths.Home: | |
return MaterialPageRoute(builder: (_) => MyHomePage()); | |
case RoutePaths.Login: | |
return MaterialPageRoute(builder: (_) => LoginPage()); | |
case RoutePaths.Register: | |
return MaterialPageRoute(builder: (_) => RegisterPage()); | |
default: | |
return MaterialPageRoute( | |
builder: (_) => Scaffold( | |
body: Center( | |
child: Text("No route found for this scenario"), | |
), | |
), | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment