show static method

Future<int?> show({
  1. required BuildContext context,
  2. String? title,
  3. String? message,
  4. required List<CNActionSheetAction> actions,
  5. CNActionSheetAction? cancelAction,
})

Shows a native iOS action sheet

Implementation

static Future<int?> show({
  required BuildContext context,
  String? title,
  String? message,
  required List<CNActionSheetAction> actions,
  CNActionSheetAction? cancelAction,
}) async {
  // Convert CNActionSheetAction to BaseActionSheetAction
  final baseActions = actions.map((action) => BaseActionSheetAction(
    title: action.title,
    style: _convertToBaseStyle(action.style),
    onPressed: action.onPressed,
  )).toList();

  final baseCancelAction = cancelAction != null
    ? BaseActionSheetAction(
        title: cancelAction.title,
        style: _convertToBaseStyle(cancelAction.style),
        onPressed: cancelAction.onPressed,
      )
    : null;

  return await BaseActionSheet.show(
    context: context,
    title: title,
    message: message,
    actions: baseActions,
    cancelAction: baseCancelAction,
  );
}