show<T> static method
Future<T?>
show<T>(
- BuildContext context, {
- required String title,
- required WidgetBuilder content,
- String? subtitle,
- Widget? headerLeading,
- bool showCloseButton = true,
- double maxWidth = 480,
- bool scrollableBody = true,
- FutureOr<
T?> onConfirm()?, - VoidCallback? onCancel,
- String confirmLabel = 'Conferma',
- String cancelLabel = 'Annulla',
- bool barrierDismissible = true,
Apre un CLDialog inline, senza sottoclasse. Ritorna il risultato di
onConfirm (o null se annullato/chiuso).
final ok = await CLDialog.show<bool>(
context,
title: 'Gestisci contatti',
headerLeading: IconBadge(icon: Icons.contacts, color: theme.primary),
maxWidth: 520,
content: (ctx) => _contactsForm,
confirmLabel: 'Salva',
onConfirm: () => vm.save(),
);
Implementation
static Future<T?> show<T>(
BuildContext context, {
required String title,
required WidgetBuilder content,
String? subtitle,
Widget? headerLeading,
bool showCloseButton = true,
double maxWidth = 480,
bool scrollableBody = true,
FutureOr<T?> Function()? onConfirm,
VoidCallback? onCancel,
String confirmLabel = 'Conferma',
String cancelLabel = 'Annulla',
bool barrierDismissible = true,
}) {
return showDialog<T>(
context: context,
barrierDismissible: barrierDismissible,
builder: (_) => _CLBuilderDialog<T>(
title: title,
subtitle: subtitle,
headerLeading: headerLeading,
showCloseButton: showCloseButton,
maxWidth: maxWidth,
scrollableBody: scrollableBody,
onConfirm: onConfirm,
onCancel: onCancel,
confirmLabel: confirmLabel,
cancelLabel: cancelLabel,
contentBuilder: content,
),
);
}