Skip to content

Commit

Permalink
Fix state not being reset on save.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 4, 2023
1 parent d971139 commit 562af5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion flutterapp/lib/screens/taskadd.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class _TaskAddScreenState extends State<TaskAddScreen> {

try {
await viewmodel.save();
_formKey.currentState!.reset();
messenger.showSnackBar(successSnackBar(context: context, text: 'Task Created'));
complete();
} catch (e, stacktrace) {
Expand All @@ -57,7 +58,9 @@ class _TaskAddScreenState extends State<TaskAddScreen> {
saving = true;
_formKey.currentState!.save();
await saveTask(context);
saving = false;
setState(() {
saving = false;
});
}
}
)
Expand Down
3 changes: 2 additions & 1 deletion flutterapp/test/screens/taskadd_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ void main() {
throw "Unexpected request to ${request.url.path}";
});

const child = TaskAddScreen();
await tester.pumpWidget(EntryPoint(
database: db,
child: const TaskAddScreen(),
child: child,
));
await tester.runAsync(() async {
await tester.pumpAndSettle();
Expand Down

0 comments on commit 562af5c

Please sign in to comment.