show static method

Future<int?> show({
  1. required BuildContext context,
  2. required String title,
  3. String? message,
  4. required List<CNAlertAction> actions,
  5. int? preferredActionIndex,
  6. BaseParam? cupertino,
  7. BaseParam? material,
})

Shows a native alert dialog.

Implementation

static Future<int?> show({
  required BuildContext context,
  required String title,
  String? message,
  required List<CNAlertAction> actions,
  int? preferredActionIndex,
  BaseParam? cupertino,
  BaseParam? material,
}) async {
  // Convert CNAlertAction to BaseAlertAction
  final baseActions = actions.map((action) => BaseAlertAction(
    title: action.title,
    style: _convertStyle(action.style),
    onPressed: action.onPressed,
  )).toList();

  return await BaseAlert.show(
    context: context,
    title: title,
    message: message,
    actions: baseActions,
    preferredActionIndex: preferredActionIndex,
    cupertino: cupertino,
    material: material,
  );
}