showActions<T> static method

Future<T?> showActions<T>({
  1. required BuildContext context,
  2. required List<AtomicBottomSheetAction<T>> actions,
  3. String? title,
  4. String? message,
  5. String? cancelLabel,
  6. bool showCancelButton = true,
  7. bool isDismissible = true,
  8. bool enableDrag = true,
})

Implementation

static Future<T?> showActions<T>({
  required BuildContext context,
  required List<AtomicBottomSheetAction<T>> actions,
  String? title,
  String? message,
  String? cancelLabel,
  bool showCancelButton = true,
  bool isDismissible = true,
  bool enableDrag = true,
}) {
  return show<T>(
    context: context,
    title: title,
    isDismissible: isDismissible,
    enableDrag: enableDrag,
    child: Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        if (message != null) ...[
          Padding(
            padding: const EdgeInsets.symmetric(
              horizontal: AtomicSpacing.lg,
              vertical: AtomicSpacing.sm,
            ),
            child: Text(
              message,
              style: AtomicTheme.of(context).typography.bodyMedium.copyWith(
                color: AtomicTheme.of(context).colors.textSecondary,
              ),
              textAlign: TextAlign.center,
            ),
          ),
          const AtomicDivider(),
        ],
        ...actions.map((action) => _ActionItem(action: action)),
        if (showCancelButton) ...[
          const AtomicDivider(),
          _ActionItem(
            action: AtomicBottomSheetAction(
              label: cancelLabel ?? 'Cancel',
              onTap: () => Navigator.of(context).pop(),
              isDestructive: false,
            ),
          ),
        ],
      ],
    ),
  );
}