Skip to content

Instantly share code, notes, and snippets.

@xrigau
Created April 16, 2018 16:17
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 xrigau/8d8248437eba0bbbe02bf3821daf959c to your computer and use it in GitHub Desktop.
Save xrigau/8d8248437eba0bbbe02bf3821daf959c to your computer and use it in GitHub Desktop.
Introduction to Redux in Flutter (to_do_list_page.dart)
class ToDoListPage extends StatelessWidget {
@override
Widget build(BuildContext context) => StoreConnector<AppState, _ViewModel>(
converter: (Store<AppState> store) => _ViewModel.create(store),
builder: (BuildContext context, _ViewModel viewModel) => Scaffold(
appBar: AppBar(
title: Text(viewModel.pageTitle),
),
body: ListView(children: viewModel.items.map((_ItemViewModel item) => _createWidget(item)).toList()),
floatingActionButton: FloatingActionButton(
onPressed: viewModel.onNewItem,
tooltip: viewModel.newItemToolTip,
child: Icon(viewModel.newItemIcon),
),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment