I'm trying to show a showCupertinoModalPopup in flutter which contains Switch, It is display correctly but does not update the Switch,. Why does the Switch not keeps the new state after update on a CupertinoActionSheet?
https://github.com/flutter/flutter/issues/62264
Future<int> countAsReturnVisit(CalendarEvent event) async {
bool remember = false;
var res = await showCupertinoModalPopup(
context: context,
builder: (BuildContext cnt) {
return Material(
color: Colors.transparent,
child: CupertinoActionSheet(
message: Wrap(
children: <Widget>[
Text(
'Do you want to count \'Completed\' events as part of Return Visits?'
.i18n),
Container(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Remember this selection'.i18n),
Switch(
value: remember,
onChanged: (value) {
setState(() {
remember = value;
});
},
activeTrackColor: Colors.lightBlue[200],
activeColor: Colors.blue,
),
],
),
),
],
),
actions: <Widget>[
CupertinoActionSheetAction(
child: Text('No'.i18n),
onPressed: () {
Navigator.pop(context, 0);
},
),
],
cancelButton: CupertinoActionSheetAction(
isDefaultAction: true,
child: Text('Yes'.i18n),
onPressed: () {
Navigator.pop(context, 1);
},
),
),
);
},
) as int;
if (res != null && res == 1) {
setCalendarAlwaysCountAsRrtuVist();
}
return res;
}