show static method
Future<void>
show(
- BuildContext context, {
- String? title,
- String? message,
- required List<
ActionSheetItem> actions, - String? cancelText,
- bool showCancel = true,
Implementation
static Future<void> show(
BuildContext context, {
String? title,
String? message,
required List<ActionSheetItem> actions,
String? cancelText,
bool showCancel = true,
}) {
final colors = BaseThemeProvider.colorsOf(context);
final appLocale = AtomicLocalizations.of(context);
return showModalBottomSheet<void>(
context: context,
backgroundColor: Colors.transparent,
isScrollControlled: true,
builder: (BuildContext context) {
return Container(
padding: const EdgeInsets.all(8),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
decoration: BoxDecoration(
color: colors.bgColorDialog,
borderRadius: BorderRadius.circular(14),
),
child: Column(
children: [
if (title != null || message != null)
Container(
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 16),
child: Column(
children: [
if (title != null)
Text(
title,
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
color: colors.textColorSecondary,
),
textAlign: TextAlign.center,
),
if (title != null && message != null)
const SizedBox(height: 4),
if (message != null)
Text(
message,
style: TextStyle(
fontSize: 13,
color: colors.textColorSecondary,
),
textAlign: TextAlign.center,
),
],
),
),
if (title != null || message != null)
_buildDivider(colors),
...actions.asMap().entries.map((entry) {
final index = entry.key;
final action = entry.value;
final isFirst = index == 0 && title == null && message == null;
final isLast = index == actions.length - 1;
return Column(
children: [
_buildActionButton(
context: context,
colors: colors,
item: action,
isFirst: isFirst,
isLast: isLast,
),
if (!isLast) _buildDivider(colors),
],
);
}).toList(),
],
),
),
if (showCancel) ...[
const SizedBox(height: 12),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: colors.bgColorDialog,
borderRadius: BorderRadius.circular(14),
),
child: _buildCancelButton(
context: context,
colors: colors,
text: cancelText ?? appLocale.cancel,
),
),
],
SizedBox(height: MediaQuery.of(context).padding.bottom),
],
),
);
},
);
}