showSmoothAlertModalSheet<T> function
A modal sheet asking for a confirmation
Implementation
Future<T?> showSmoothAlertModalSheet<T>({
required BuildContext context,
required String title,
required Widget message,
required Iterable<String> actionLabels,
required Iterable<T> actionValues,
required List<Widget> actionIcons,
SmoothModalSheetType type = SmoothModalSheetType.info,
bool safeArea = true,
Color? messageBackgroundColor,
}) {
final bool lightTheme = context.lightTheme(listen: false);
final Color headerBackgroundColor =
messageBackgroundColor ??
switch (type) {
SmoothModalSheetType.error when lightTheme =>
SmoothModalSheetHeader.ERROR_COLOR.lighten(0.55),
SmoothModalSheetType.error => SmoothModalSheetHeader.ERROR_COLOR.darken(
0.3,
),
SmoothModalSheetType.info when lightTheme =>
context.extension<SmoothColorsThemeExtension>().primaryLight,
SmoothModalSheetType.info =>
context.extension<SmoothColorsThemeExtension>().primaryDark.darken(
0.1,
),
};
return showSmoothListOfChoicesModalSheet<T>(
context: context,
title: title,
type: type,
header: ColoredBox(
color: headerBackgroundColor,
child: Padding(
padding: const EdgeInsetsDirectional.symmetric(
horizontal: LARGE_SPACE,
vertical: MEDIUM_SPACE,
),
child: DefaultTextStyle.merge(
style: Theme.of(
context,
).textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w600),
child: message,
),
),
),
labels: actionLabels,
values: actionValues,
prefixIcons: actionIcons,
dividerPadding: const EdgeInsetsDirectional.symmetric(
horizontal: MEDIUM_SPACE,
),
textStyle: const TextStyle(fontWeight: FontWeight.w600),
);
}