actionSheet<T> static method
List of actions in a bottom sheet with a Cancel row. UNavigator.actionSheet(actions: [UNavAction(label: "Edit", onTap: edit)])
Implementation
static Future<T?> actionSheet<T>({
required List<UNavAction> actions,
String? title,
String? message,
bool showCancel = true,
String? cancelText,
bool barrierDismissible = true,
}) => showModalBottomSheet<T>(
context: navigatorKey.currentContext!,
isDismissible: barrierDismissible,
showDragHandle: true,
builder: (BuildContext context) => SafeArea(
child: UColumn(
spacing: 8,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
if (title != null) UTextTitleMedium(title, textAlign: TextAlign.center).pOnly(bottom: 4),
if (message != null) UTextBodySmall(message, textAlign: TextAlign.center).pOnly(bottom: 8),
...actions.map(
(UNavAction action) => ListTile(
enabled: action.enabled,
leading: action.icon != null ? Icon(action.icon, color: action.isDestructive ? Theme.of(context).colorScheme.error : null) : null,
trailing: Icon(Icons.arrow_forward_ios, color: action.isDestructive ? Theme.of(context).colorScheme.error : null),
title: UTextBodyLarge(action.label, color: action.isDestructive ? Theme.of(context).colorScheme.error : null),
onTap: action.onTap,
),
),
if (showCancel)
ListTile(
title: UTextBodyLarge(cancelText ?? U.s.cancel, textAlign: TextAlign.center),
onTap: back,
),
],
),
),
);