showActionSheet<T> static method
Future<T?>
showActionSheet<
T>({ - required BuildContext context,
- required List<AtomicSheetAction<T>> actions,
- String? title,
- String? message,
- bool showCancelButton = true,
- String cancelText = 'Cancel',
- Color? backgroundColor,
- Color? actionColor,
- Color? cancelColor,
- bool isDismissible = true,
- bool enableDrag = true,
})
Implementation
static Future<T?> showActionSheet<T>({
required BuildContext context,
required List<AtomicSheetAction<T>> actions,
String? title,
String? message,
bool showCancelButton = true,
String cancelText = 'Cancel',
Color? backgroundColor,
Color? actionColor,
Color? cancelColor,
bool isDismissible = true,
bool enableDrag = true,
}) {
final theme = AtomicTheme.of(context);
return showCustomSheet<T>(
context: context,
isDismissible: isDismissible,
enableDrag: enableDrag,
scrollable: false,
builder: (context) => Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (title != null || message != null)
Padding(
padding: EdgeInsets.only(
bottom: theme.spacing.md,
),
child: Column(
children: [
if (title != null)
Text(
title,
style: theme.typography.titleMedium.copyWith(
fontWeight: FontWeight.w600,
),
textAlign: TextAlign.center,
),
if (title != null && message != null)
SizedBox(height: theme.spacing.xs),
if (message != null)
Text(
message,
style: theme.typography.bodyMedium.copyWith(
color: theme.colors.textSecondary,
),
textAlign: TextAlign.center,
),
],
),
),
...actions.map((action) => _buildActionItem(
context: context,
action: action,
theme: theme,
actionColor: actionColor,
)),
if (showCancelButton) ...[
SizedBox(height: theme.spacing.sm),
_buildCancelButton(
context: context,
theme: theme,
cancelText: cancelText,
cancelColor: cancelColor,
),
],
],
),
);
}