Skip to content

Instantly share code, notes, and snippets.

@juliuscanute
Created November 16, 2019 04:20
Show Gist options
  • Save juliuscanute/971d6bb5c148c5aaa329c8219d7a44f6 to your computer and use it in GitHub Desktop.
Save juliuscanute/971d6bb5c148c5aaa329c8219d7a44f6 to your computer and use it in GitHub Desktop.
[Define routes] #navigation #dart #redux #flutter #push #getarguments
@override
Widget build(BuildContext context) {
Map args = ModalRoute.of(context).settings.arguments;
var _email;
if (args != null) {
_email = args["email"];
}
}
class _ViewModel {
final Store<LoginAppState> store;
const _ViewModel({this.store});
static _ViewModel fromStore(Store<LoginAppState> store) {
return _ViewModel(store: store);
}
void signUp() {
store.dispatch(NavigateToAction.push('/signup'));
}
void forgotPassword() {
store.dispatch(NavigateToAction.push('/forgot'));
}
}
@override
Widget build(BuildContext context) {
return StoreProvider<LoginAppState>(
store: store,
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Time Sheet',
theme: ThemeData(
primarySwatch: Colors.blue,
),
navigatorKey: NavigatorHolder.navigatorKey,
routes: {
'/home': (BuildContext context) => Scaffold(
body: HomeScreen(),
),
'/login': (BuildContext context) => Scaffold(
body: LoginScreen(),
),
'/signup': (BuildContext context) => Scaffold(
body: SignUpScreen(),
),
'/forgot': (BuildContext context) => Scaffold(
body: ForgotPasswordScreen(),
),
},
home: Scaffold(
body: LoadScreen(),
)),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment