buildChild method
Implementation
@override
Widget buildChild(BuildContext context) {
final actions = <Widget>[...widget.actions];
if (widget.cancel != null && widget.cache) {
actions.add(
TextButton(
onPressed: () {
Navigator.of(context).pop(false);
},
child: widget.cancel!,
),
);
}
if (widget.submit != null) {
actions.add(
TextButton(
onPressed: () async {
final navigator = Navigator.of(context);
await apply();
navigator.pop(true);
if (widget.onSubmit != null) {
widget.onSubmit!();
}
},
child: widget.submit!,
),
);
}
if (widget.dismissOnChange) {
late final void Function() f;
f = () async {
final navigator = Navigator.of(context);
PrefService.of(context).removeListener(f);
await apply();
navigator.pop(true);
};
PrefService.of(context).addListener(f);
}
return AlertDialog(
title: widget.title,
content: SingleChildScrollView(
child: Column(
children: widget.children,
),
),
actions: actions,
);
}