Skip to content

Commit 49c5fb4

Browse files
Relations example: clear tag text in any case dialog is dismissed (#23)
1 parent 79ca310 commit 49c5fb4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

objectbox/example/flutter/objectbox_demo_relations/lib/tag_elements.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class _NewTagState extends State<NewTag> {
2828
return FloatingActionButton.extended(
2929
label: const Text('New Tag'),
3030
heroTag: null,
31-
onPressed: () => {
32-
showDialog(
31+
onPressed: () async {
32+
final dialog = await showDialog(
3333
context: context,
3434
builder: (BuildContext context) => AlertDialog(
3535
title: const Text('New tag'),
@@ -43,14 +43,15 @@ class _NewTagState extends State<NewTag> {
4343
child: const Text('Submit'),
4444
onPressed: () {
4545
_addTag(_tagInputController.text);
46-
_tagInputController.clear();
47-
4846
Navigator.of(context).pop();
4947
},
5048
),
5149
],
5250
),
53-
)
51+
);
52+
// Clear text after dialog is dismissed.
53+
_tagInputController.clear();
54+
return dialog;
5455
},
5556
);
5657
}

0 commit comments

Comments
 (0)