apply directly when tapping option in selection dialogs

This commit is contained in:
Thibault Deckers 2020-09-04 22:10:30 +09:00
parent 751f2fcacc
commit 48606a9e39

View file

@ -37,11 +37,6 @@ class _AvesSelectionDialogState<T> extends State<AvesSelectionDialog> {
onPressed: () => Navigator.pop(context),
child: Text('Cancel'.toUpperCase()),
),
FlatButton(
key: Key('apply-button'),
onPressed: () => Navigator.pop(context, _selectedValue),
child: Text('Apply'.toUpperCase()),
),
],
);
}
@ -50,7 +45,11 @@ class _AvesSelectionDialogState<T> extends State<AvesSelectionDialog> {
key: Key(value.toString()),
value: value,
groupValue: _selectedValue,
onChanged: (v) => setState(() => _selectedValue = v),
onChanged: (v) {
_selectedValue = v;
Navigator.pop(context, _selectedValue);
setState(() {});
},
title: Text(
title,
softWrap: false,