Last active
October 17, 2020 13:05
-
-
Save panthe/32a1ba101512c60f8f3f4745a6d92843 to your computer and use it in GitHub Desktop.
Button that dispatch an action in Redux
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
class TopBarTabs extends StatelessWidget { | |
final store = StoreProvider.of<AppState>(Keys.scaffoldKey.currentContext); | |
@override | |
Widget build(BuildContext context) { | |
return LayoutBuilder( | |
builder: (context, constraints) { | |
return Row( | |
mainAxisAlignment: MainAxisAlignment.end, | |
children: <Widget>[ | |
Container( | |
height: 35.0, | |
width: 150.0, | |
child: FlatButton( | |
onPressed: () => store.dispatch(FetchUser()), | |
color: Colors.deepOrange, | |
child: Text( | |
"FETCH USER", | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: 18.0, | |
fontWeight: FontWeight.normal | |
), | |
textAlign: TextAlign.start, | |
), | |
) | |
), | |
], | |
); | |
} | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment