Skip to content

Instantly share code, notes, and snippets.

@panthe
Last active October 17, 2020 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panthe/32a1ba101512c60f8f3f4745a6d92843 to your computer and use it in GitHub Desktop.
Save panthe/32a1ba101512c60f8f3f4745a6d92843 to your computer and use it in GitHub Desktop.
Button that dispatch an action in Redux
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