Created
August 25, 2020 10:11
-
-
Save liemvo/492a0914fcd054a4f8ca91cb1754267e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_showMultiChoiceDialog(BuildContext context) => showDialog( | |
context: context, | |
builder: (context) { | |
final _multipleNotifier = Provider.of<MultipleNotifier>(context); | |
return AlertDialog( | |
title: Text("Select one country or many countries"), | |
content: SingleChildScrollView( | |
child: Container( | |
width: double.infinity, | |
child: Column( | |
mainAxisSize: MainAxisSize.min, | |
children: countries | |
.map((e) => CheckboxListTile( | |
title: Text(e), | |
onChanged: (value) { | |
value | |
? _multipleNotifier.addItem(e) | |
: _multipleNotifier.removeItem(e); | |
}, | |
value: _multipleNotifier.isHaveItem(e), | |
)) | |
.toList(), | |
), | |
), | |
), | |
actions: [ | |
FlatButton( | |
child: Text("Yes"), | |
onPressed: () { | |
Navigator.of(context).pop(); | |
}, | |
), | |
], | |
); | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment