buildButtons method
Implementation
Widget? buildButtons(BuildContext context) {
if (btnNeutral == null && btnNeutralText != null) {
btnNeutral = TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(
btnNeutralColor ?? Theme.of(context).colorScheme.secondary),
),
onPressed: btnNeutralAction ?? () => Navigator.of(context).pop(),
child: Text(btnNeutralText!),
);
}
if (btnCancel == null && btnCancelText != null) {
btnCancel = TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(
btnCancelColor ?? Theme.of(context).colorScheme.secondary),
),
onPressed: btnCancelAction ?? () => Navigator.of(context).pop(),
child: Text(btnCancelText!),
);
}
if (btnOk == null && btnOkText != null) {
btnOk = TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(
btnOkColor ?? Theme.of(context).colorScheme.secondary),
),
onPressed: btnOkAction ?? () => Navigator.of(context).pop(),
child: Text(btnOkText!),
);
}
return (btnNeutral != null || btnCancel != null || btnOk != null)
? Wrap(
alignment: WrapAlignment.center,
spacing: 8,
children: <Widget>[
if (btnNeutral != null) btnNeutral!,
if (btnCancel != null) btnCancel!,
if (btnOk != null) btnOk!,
],
)
: null;
}