Commit b613648a authored by Brian Egan's avatar Brian Egan

Get built_redux sample running with the integration tests

parent 28890e40
...@@ -2,6 +2,7 @@ import 'package:built_redux_sample/models/models.dart'; ...@@ -2,6 +2,7 @@ import 'package:built_redux_sample/models/models.dart';
import 'package:built_redux_sample/actions/actions.dart'; import 'package:built_redux_sample/actions/actions.dart';
import 'package:built_redux_sample/presentation/add_edit_screen.dart'; import 'package:built_redux_sample/presentation/add_edit_screen.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
import 'package:flutter_built_redux/flutter_built_redux.dart'; import 'package:flutter_built_redux/flutter_built_redux.dart';
class EditTodo class EditTodo
...@@ -13,6 +14,7 @@ class EditTodo ...@@ -13,6 +14,7 @@ class EditTodo
@override @override
Widget build(BuildContext context, _, AppActions actions) { Widget build(BuildContext context, _, AppActions actions) {
return new AddEditScreen( return new AddEditScreen(
key: ArchSampleKeys.editTodoScreen,
isEditing: true, isEditing: true,
onSave: (task, note) { onSave: (task, note) {
actions.updateTodoAction(new UpdateTodoActionPayload( actions.updateTodoAction(new UpdateTodoActionPayload(
......
...@@ -5,7 +5,6 @@ import 'package:flutter/src/widgets/framework.dart'; ...@@ -5,7 +5,6 @@ import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart'; import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
import 'package:flutter_built_redux/flutter_built_redux.dart'; import 'package:flutter_built_redux/flutter_built_redux.dart';
typedef OnTabsSelected = void Function(int); typedef OnTabsSelected = void Function(int);
class TabSelector class TabSelector
...@@ -25,7 +24,12 @@ class TabSelector ...@@ -25,7 +24,12 @@ class TabSelector
}, },
items: AppTab.values.map((tab) { items: AppTab.values.map((tab) {
return new BottomNavigationBarItem( return new BottomNavigationBarItem(
icon: new Icon(tab == AppTab.todos ? Icons.list : Icons.show_chart), icon: new Icon(
tab == AppTab.todos ? Icons.list : Icons.show_chart,
key: tab == AppTab.stats
? ArchSampleKeys.statsTab
: ArchSampleKeys.todoTab,
),
title: new Text(tab == AppTab.stats title: new Text(tab == AppTab.stats
? ArchSampleLocalizations.of(context).stats ? ArchSampleLocalizations.of(context).stats
: ArchSampleLocalizations.of(context).todos), : ArchSampleLocalizations.of(context).todos),
......
import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter/src/widgets/framework.dart';
typedef ViewModelBuilder<ViewModel> = Function( typedef ViewModelBuilder<ViewModel> = Function(
BuildContext context, ViewModel vm BuildContext context, ViewModel vm);
);
...@@ -11,13 +11,16 @@ import 'package:path_provider/path_provider.dart'; ...@@ -11,13 +11,16 @@ import 'package:path_provider/path_provider.dart';
/// In most apps, we use the provided repository. In this case, it makes sense /// In most apps, we use the provided repository. In this case, it makes sense
/// to demonstrate the built_value serializers, which are used in the /// to demonstrate the built_value serializers, which are used in the
/// FileStorage part of this app. /// FileStorage part of this app.
///
/// Please see the `todos_repository` library for more information about the
/// Repository pattern.
class TodosRepository { class TodosRepository {
final FileStorage fileStorage; final FileStorage fileStorage;
final WebClient webClient; final WebClient webClient;
const TodosRepository({ const TodosRepository({
this.fileStorage = const FileStorage( this.fileStorage = const FileStorage(
'__built_redux__', '__built_redux_sample_app__',
getApplicationDocumentsDirectory, getApplicationDocumentsDirectory,
), ),
this.webClient = const WebClient(), this.webClient = const WebClient(),
......
...@@ -9,7 +9,7 @@ import 'package:built_redux_sample/models/models.dart'; ...@@ -9,7 +9,7 @@ import 'package:built_redux_sample/models/models.dart';
class WebClient { class WebClient {
final Duration delay; final Duration delay;
const WebClient([this.delay = const Duration(milliseconds: 3000)]); const WebClient([this.delay = const Duration(milliseconds: 1200)]);
/// Mock that "fetches" some Todos from a "web service" after a short delay /// Mock that "fetches" some Todos from a "web service" after a short delay
Future<List<Todo>> fetchTodos() async { Future<List<Todo>> fetchTodos() async {
...@@ -19,24 +19,32 @@ class WebClient { ...@@ -19,24 +19,32 @@ class WebClient {
new Todo.builder( new Todo.builder(
(b) => b (b) => b
..task = 'Buy food for da kitty' ..task = 'Buy food for da kitty'
..note = 'With the chickeny bits!', ..note = 'With the chickeny bits!'
..id = '1',
), ),
new Todo.builder( new Todo.builder(
(b) => b (b) => b
..task = 'Find a Red Sea dive trip' ..task = 'Find a Red Sea dive trip'
..note = 'Echo vs MY Dream', ..note = 'Echo vs MY Dream'
..id = '2',
), ),
new Todo.builder( new Todo.builder(
(b) => b (b) => b
..task = 'Book flights to Egypt' ..task = 'Book flights to Egypt'
..complete = true, ..complete = true
..id = '3',
),
new Todo.builder(
(b) => b
..task = 'Decide on accommodation'
..id = '4',
), ),
new Todo('Decide on accommodation'),
new Todo.builder( new Todo.builder(
(b) => b (b) => b
..task = 'Sip Margaritas' ..task = 'Sip Margaritas'
..note = 'on the beach' ..note = 'on the beach'
..complete = true, ..complete = true
..id = '5',
), ),
]); ]);
} }
......
...@@ -16,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
runApp(new BuiltReduxApp()); runApp(new BuiltReduxApp());
} }
class BuiltReduxApp extends StatelessWidget { class BuiltReduxApp extends StatefulWidget {
final store = new Store<AppState, AppStateBuilder, AppActions>( final store = new Store<AppState, AppStateBuilder, AppActions>(
reducerBuilder.build(), reducerBuilder.build(),
new AppState.loading(), new AppState.loading(),
...@@ -26,8 +26,26 @@ class BuiltReduxApp extends StatelessWidget { ...@@ -26,8 +26,26 @@ class BuiltReduxApp extends StatelessWidget {
], ],
); );
@override
State<StatefulWidget> createState() {
return new BuiltReduxAppState();
}
}
class BuiltReduxAppState extends State<BuiltReduxApp> {
Store<AppState, AppStateBuilder, AppActions> store;
BuiltReduxApp() {} BuiltReduxApp() {}
@override
void initState() {
store = widget.store;
store.actions.fetchTodosAction();
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new ReduxProvider( return new ReduxProvider(
...@@ -41,9 +59,7 @@ class BuiltReduxApp extends StatelessWidget { ...@@ -41,9 +59,7 @@ class BuiltReduxApp extends StatelessWidget {
], ],
routes: { routes: {
ArchSampleRoutes.home: (context) { ArchSampleRoutes.home: (context) {
store.actions.fetchTodosAction(); return new HomeScreen(key: ArchSampleKeys.homeScreen);
return new HomeScreen();
}, },
ArchSampleRoutes.addTodo: (context) { ArchSampleRoutes.addTodo: (context) {
return new AddTodo(); return new AddTodo();
......
...@@ -11,6 +11,8 @@ Middleware<AppState, AppStateBuilder, AppActions> createStoreTodosMiddleware([ ...@@ -11,6 +11,8 @@ Middleware<AppState, AppStateBuilder, AppActions> createStoreTodosMiddleware([
..add(AppActionsNames.addTodoAction, createSaveTodos<Todo>(service)) ..add(AppActionsNames.addTodoAction, createSaveTodos<Todo>(service))
..add(AppActionsNames.clearCompletedAction, ..add(AppActionsNames.clearCompletedAction,
createSaveTodos<Null>(service)) createSaveTodos<Null>(service))
..add(AppActionsNames.loadTodosSuccess,
createSaveTodos<List<Todo>>(service))
..add( ..add(
AppActionsNames.deleteTodoAction, createSaveTodos<String>(service)) AppActionsNames.deleteTodoAction, createSaveTodos<String>(service))
..add(AppActionsNames.toggleAllAction, createSaveTodos<Null>(service)) ..add(AppActionsNames.toggleAllAction, createSaveTodos<Null>(service))
...@@ -24,10 +26,9 @@ MiddlewareHandler<AppState, AppStateBuilder, AppActions, Null> createFetchTodos( ...@@ -24,10 +26,9 @@ MiddlewareHandler<AppState, AppStateBuilder, AppActions, Null> createFetchTodos(
return (MiddlewareApi<AppState, AppStateBuilder, AppActions> api, return (MiddlewareApi<AppState, AppStateBuilder, AppActions> api,
ActionHandler next, Action<Null> action) { ActionHandler next, Action<Null> action) {
if (api.state.isLoading) { if (api.state.isLoading) {
service service.loadTodos().then((todos) {
.loadTodos() return api.actions.loadTodosSuccess(todos);
.then(api.actions.loadTodosSuccess) }).catchError(api.actions.loadTodosFailure);
.catchError(api.actions.loadTodosFailure);
} }
next(action); next(action);
......
...@@ -35,4 +35,4 @@ class AppTab extends EnumClass { ...@@ -35,4 +35,4 @@ class AppTab extends EnumClass {
return 0; return 0;
} }
} }
} }
\ No newline at end of file
...@@ -17,4 +17,4 @@ class ExtraAction extends EnumClass { ...@@ -17,4 +17,4 @@ class ExtraAction extends EnumClass {
static BuiltSet<ExtraAction> get values => _$extraActionValues; static BuiltSet<ExtraAction> get values => _$extraActionValues;
static ExtraAction valueOf(String name) => _$extraActionValueOf(name); static ExtraAction valueOf(String name) => _$extraActionValueOf(name);
} }
\ No newline at end of file
...@@ -15,7 +15,7 @@ class DetailsScreen extends StatelessWidget { ...@@ -15,7 +15,7 @@ class DetailsScreen extends StatelessWidget {
@required this.onDelete, @required this.onDelete,
@required this.toggleCompleted, @required this.toggleCompleted,
}) })
: super(key: key); : super(key: ArchSampleKeys.todoDetailsScreen);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -28,6 +28,7 @@ class DetailsScreen extends StatelessWidget { ...@@ -28,6 +28,7 @@ class DetailsScreen extends StatelessWidget {
new IconButton( new IconButton(
tooltip: localizations.deleteTodo, tooltip: localizations.deleteTodo,
icon: new Icon(Icons.delete), icon: new Icon(Icons.delete),
key: ArchSampleKeys.deleteTodoButton,
onPressed: () { onPressed: () {
onDelete(); onDelete();
Navigator.pop(context, todo); Navigator.pop(context, todo);
...@@ -45,6 +46,7 @@ class DetailsScreen extends StatelessWidget { ...@@ -45,6 +46,7 @@ class DetailsScreen extends StatelessWidget {
new Padding( new Padding(
padding: new EdgeInsets.only(right: 8.0), padding: new EdgeInsets.only(right: 8.0),
child: new Checkbox( child: new Checkbox(
key: ArchSampleKeys.detailsTodoItemCheckbox,
value: todo.complete, value: todo.complete,
onChanged: toggleCompleted, onChanged: toggleCompleted,
), ),
...@@ -60,11 +62,13 @@ class DetailsScreen extends StatelessWidget { ...@@ -60,11 +62,13 @@ class DetailsScreen extends StatelessWidget {
), ),
child: new Text( child: new Text(
todo.task, todo.task,
key: ArchSampleKeys.detailsTodoItemTask,
style: Theme.of(context).textTheme.headline, style: Theme.of(context).textTheme.headline,
), ),
), ),
new Text( new Text(
todo.note, todo.note,
key: ArchSampleKeys.detailsTodoItemNote,
style: Theme.of(context).textTheme.subhead, style: Theme.of(context).textTheme.subhead,
) )
], ],
...@@ -76,6 +80,7 @@ class DetailsScreen extends StatelessWidget { ...@@ -76,6 +80,7 @@ class DetailsScreen extends StatelessWidget {
), ),
), ),
floatingActionButton: new FloatingActionButton( floatingActionButton: new FloatingActionButton(
key: ArchSampleKeys.editTodoFab,
tooltip: localizations.editTodo, tooltip: localizations.editTodo,
child: new Icon(Icons.edit), child: new Icon(Icons.edit),
onPressed: () { onPressed: () {
......
...@@ -16,18 +16,21 @@ class ExtraActionsButton extends StatelessWidget { ...@@ -16,18 +16,21 @@ class ExtraActionsButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new PopupMenuButton<ExtraAction>( return new PopupMenuButton<ExtraAction>(
key: ArchSampleKeys.extraActionsButton,
onSelected: onSelected, onSelected: onSelected,
itemBuilder: (BuildContext context) => <PopupMenuItem<ExtraAction>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<ExtraAction>>[
new PopupMenuItem<ExtraAction>( new PopupMenuItem<ExtraAction>(
key: ArchSampleKeys.toggleAll,
value: ExtraAction.toggleAllComplete, value: ExtraAction.toggleAllComplete,
child: new Text(allComplete child: new Text(allComplete
? ArchSampleLocalizations.of(context).markAllIncomplete ? ArchSampleLocalizations.of(context).markAllIncomplete
: ArchSampleLocalizations.of(context).markAllComplete), : ArchSampleLocalizations.of(context).markAllComplete),
), ),
new PopupMenuItem<ExtraAction>( new PopupMenuItem<ExtraAction>(
key: ArchSampleKeys.clearCompleted,
value: ExtraAction.clearCompleted, value: ExtraAction.clearCompleted,
child: new Text( child:
ArchSampleLocalizations.of(context).clearCompleted), new Text(ArchSampleLocalizations.of(context).clearCompleted),
), ),
], ],
); );
......
...@@ -23,6 +23,7 @@ class FilterButton extends StatelessWidget { ...@@ -23,6 +23,7 @@ class FilterButton extends StatelessWidget {
opacity: visible ? 1.0 : 0.0, opacity: visible ? 1.0 : 0.0,
duration: new Duration(milliseconds: 150), duration: new Duration(milliseconds: 150),
child: new PopupMenuButton<VisibilityFilter>( child: new PopupMenuButton<VisibilityFilter>(
key: ArchSampleKeys.filterButton,
tooltip: ArchSampleLocalizations.of(context).filterTodos, tooltip: ArchSampleLocalizations.of(context).filterTodos,
onSelected: onSelected, onSelected: onSelected,
itemBuilder: (BuildContext context) => itemBuilder: (BuildContext context) =>
...@@ -31,6 +32,7 @@ class FilterButton extends StatelessWidget { ...@@ -31,6 +32,7 @@ class FilterButton extends StatelessWidget {
value: VisibilityFilter.all, value: VisibilityFilter.all,
child: new Text( child: new Text(
ArchSampleLocalizations.of(context).showAll, ArchSampleLocalizations.of(context).showAll,
key: ArchSampleKeys.allFilter,
style: activeFilter == VisibilityFilter.all style: activeFilter == VisibilityFilter.all
? activeStyle ? activeStyle
: defaultStyle, : defaultStyle,
...@@ -40,6 +42,7 @@ class FilterButton extends StatelessWidget { ...@@ -40,6 +42,7 @@ class FilterButton extends StatelessWidget {
value: VisibilityFilter.active, value: VisibilityFilter.active,
child: new Text( child: new Text(
ArchSampleLocalizations.of(context).showActive, ArchSampleLocalizations.of(context).showActive,
key: ArchSampleKeys.activeFilter,
style: activeFilter == VisibilityFilter.active style: activeFilter == VisibilityFilter.active
? activeStyle ? activeStyle
: defaultStyle, : defaultStyle,
...@@ -49,6 +52,7 @@ class FilterButton extends StatelessWidget { ...@@ -49,6 +52,7 @@ class FilterButton extends StatelessWidget {
value: VisibilityFilter.completed, value: VisibilityFilter.completed,
child: new Text( child: new Text(
ArchSampleLocalizations.of(context).showCompleted, ArchSampleLocalizations.of(context).showCompleted,
key: ArchSampleKeys.completedFilter,
style: activeFilter == VisibilityFilter.completed style: activeFilter == VisibilityFilter.completed
? activeStyle ? activeStyle
: defaultStyle, : defaultStyle,
......
...@@ -18,9 +18,10 @@ class StatsCounter extends StatelessWidget { ...@@ -18,9 +18,10 @@ class StatsCounter extends StatelessWidget {
return new AppLoading(builder: (context, loading) { return new AppLoading(builder: (context, loading) {
return loading return loading
? new Center( ? new Center(
child: new CircularProgressIndicator(
key: ArchSampleKeys.statsLoading, key: ArchSampleKeys.statsLoading,
)) child: new CircularProgressIndicator(
key: ArchSampleKeys.statsLoading,
))
: new Center( : new Center(
child: new Column( child: new Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
...@@ -36,6 +37,7 @@ class StatsCounter extends StatelessWidget { ...@@ -36,6 +37,7 @@ class StatsCounter extends StatelessWidget {
padding: new EdgeInsets.only(bottom: 24.0), padding: new EdgeInsets.only(bottom: 24.0),
child: new Text( child: new Text(
'$numCompleted', '$numCompleted',
key: ArchSampleKeys.statsNumCompleted,
style: Theme.of(context).textTheme.subhead, style: Theme.of(context).textTheme.subhead,
), ),
), ),
...@@ -50,6 +52,7 @@ class StatsCounter extends StatelessWidget { ...@@ -50,6 +52,7 @@ class StatsCounter extends StatelessWidget {
padding: new EdgeInsets.only(bottom: 24.0), padding: new EdgeInsets.only(bottom: 24.0),
child: new Text( child: new Text(
"$numActive", "$numActive",
key: ArchSampleKeys.statsNumActive,
style: Theme.of(context).textTheme.subhead, style: Theme.of(context).textTheme.subhead,
), ),
) )
......
import 'package:built_redux_sample/models/models.dart'; import 'package:built_redux_sample/models/models.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
class TodoItem extends StatelessWidget { class TodoItem extends StatelessWidget {
final DismissDirectionCallback onDismissed; final DismissDirectionCallback onDismissed;
...@@ -13,7 +14,8 @@ class TodoItem extends StatelessWidget { ...@@ -13,7 +14,8 @@ class TodoItem extends StatelessWidget {
@required this.onTap, @required this.onTap,
@required this.onCheckboxChanged, @required this.onCheckboxChanged,
@required this.todo, @required this.todo,
}); })
: super(key: ArchSampleKeys.todoItem(todo.id));
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -23,15 +25,18 @@ class TodoItem extends StatelessWidget { ...@@ -23,15 +25,18 @@ class TodoItem extends StatelessWidget {
child: new ListTile( child: new ListTile(
onTap: onTap, onTap: onTap,
leading: new Checkbox( leading: new Checkbox(
key: ArchSampleKeys.todoItemCheckbox(todo.id),
value: todo.complete, value: todo.complete,
onChanged: onCheckboxChanged, onChanged: onCheckboxChanged,
), ),
title: new Text( title: new Text(
todo.task, todo.task,
key: ArchSampleKeys.todoItemTask(todo.id),
style: Theme.of(context).textTheme.title, style: Theme.of(context).textTheme.title,
), ),
subtitle: new Text( subtitle: new Text(
todo.note, todo.note,
key: ArchSampleKeys.todoItemNote(todo.id),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.subhead, style: Theme.of(context).textTheme.subhead,
......
...@@ -25,9 +25,10 @@ class TodoList extends StatelessWidget { ...@@ -25,9 +25,10 @@ class TodoList extends StatelessWidget {
return new AppLoading(builder: (context, loading) { return new AppLoading(builder: (context, loading) {
return loading return loading
? new Center( ? new Center(
key: ArchSampleKeys.todosLoading,
child: new CircularProgressIndicator( child: new CircularProgressIndicator(
key: ArchSampleKeys.statsLoading, key: ArchSampleKeys.statsLoading,
)) ))
: new Container( : new Container(
child: new ListView.builder( child: new ListView.builder(
key: ArchSampleKeys.todoList, key: ArchSampleKeys.todoList,
...@@ -55,6 +56,7 @@ class TodoList extends StatelessWidget { ...@@ -55,6 +56,7 @@ class TodoList extends StatelessWidget {
onRemove(todo); onRemove(todo);
Scaffold.of(context).showSnackBar(new SnackBar( Scaffold.of(context).showSnackBar(new SnackBar(
key: ArchSampleKeys.snackbar,
duration: new Duration(seconds: 2), duration: new Duration(seconds: 2),
backgroundColor: Theme.of(context).backgroundColor, backgroundColor: Theme.of(context).backgroundColor,
content: new Text( content: new Text(
...@@ -81,6 +83,7 @@ class TodoList extends StatelessWidget { ...@@ -81,6 +83,7 @@ class TodoList extends StatelessWidget {
if (removedTodo != null) { if (removedTodo != null) {
Scaffold.of(context).showSnackBar( Scaffold.of(context).showSnackBar(
new SnackBar( new SnackBar(
key: ArchSampleKeys.snackbar,
duration: new Duration(seconds: 2), duration: new Duration(seconds: 2),
backgroundColor: Theme.of(context).backgroundColor, backgroundColor: Theme.of(context).backgroundColor,
content: new Text( content: new Text(
......
...@@ -20,6 +20,10 @@ dev_dependencies: ...@@ -20,6 +20,10 @@ dev_dependencies:
source_gen: ^0.7.0 source_gen: ^0.7.0
test: any test: any
mockito: 2.2.0 mockito: 2.2.0
flutter_driver:
sdk: flutter
integration_tests:
path: ../integration_tests
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec # following page: https://www.dartlang.org/tools/pub/pubspec
......
// This line imports the extension
import 'package:flutter_driver/driver_extension.dart';
import 'package:built_redux_sample/main.dart' as app;
void main() {
enableFlutterDriverExtension();
app.main();
}
import 'package:integration_tests/integration_tests.dart' as integrationTests;
main() {
integrationTests.main();
}
...@@ -15,4 +15,4 @@ Future main(List<String> args) async { ...@@ -15,4 +15,4 @@ Future main(List<String> args) async {
'built_redux_sample', 'built_redux_sample',
inputs: const ['lib/**/*.dart']) inputs: const ['lib/**/*.dart'])
], deleteFilesByDefault: true); ], deleteFilesByDefault: true);
} }
\ No newline at end of file
...@@ -15,4 +15,4 @@ Future main(List<String> args) async { ...@@ -15,4 +15,4 @@ Future main(List<String> args) async {
'built_redux_sample', 'built_redux_sample',
inputs: const ['lib/**/*.dart']) inputs: const ['lib/**/*.dart'])
], deleteFilesByDefault: true); ], deleteFilesByDefault: true);
} }
\ No newline at end of file
...@@ -4,7 +4,6 @@ import 'package:inherited_widget_sample/localization.dart'; ...@@ -4,7 +4,6 @@ import 'package:inherited_widget_sample/localization.dart';
import 'package:inherited_widget_sample/screens/add_edit_screen.dart'; import 'package:inherited_widget_sample/screens/add_edit_screen.dart';
import 'package:inherited_widget_sample/screens/home_screen.dart'; import 'package:inherited_widget_sample/screens/home_screen.dart';
class InheritedWidgetApp extends StatelessWidget { class InheritedWidgetApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -3,4 +3,4 @@ import 'package:inherited_widget_sample/state_container.dart'; ...@@ -3,4 +3,4 @@ import 'package:inherited_widget_sample/state_container.dart';
void main() { void main() {
runApp(new StateContainerController()); runApp(new StateContainerController());
} }
\ No newline at end of file
...@@ -16,8 +16,7 @@ class AppState { ...@@ -16,8 +16,7 @@ class AppState {
bool get allComplete => todos.every((todo) => todo.complete); bool get allComplete => todos.every((todo) => todo.complete);
List<Todo> get filteredTodos => List<Todo> get filteredTodos => todos.where((todo) {
todos.where((todo) {
if (activeFilter == VisibilityFilter.all) { if (activeFilter == VisibilityFilter.all) {
return true; return true;
} else if (activeFilter == VisibilityFilter.active) { } else if (activeFilter == VisibilityFilter.active) {
......
...@@ -31,8 +31,8 @@ class ExtraActionsButton extends StatelessWidget { ...@@ -31,8 +31,8 @@ class ExtraActionsButton extends StatelessWidget {
new PopupMenuItem<ExtraAction>( new PopupMenuItem<ExtraAction>(
key: ArchSampleKeys.clearCompleted, key: ArchSampleKeys.clearCompleted,
value: ExtraAction.clearCompleted, value: ExtraAction.clearCompleted,
child: new Text( child:
ArchSampleLocalizations.of(context).clearCompleted), new Text(ArchSampleLocalizations.of(context).clearCompleted),
), ),
], ],
); );
......