showActionSheet static method
void
showActionSheet({
- Widget? title,
- Widget? content,
- List<
Widget> ? actions, - Widget? cancel,
- VoidCallback? onCancel,
- ValueChanged<
int> ? onConfirm,
Implementation
static void showActionSheet({
Widget? title,
Widget? content,
List<Widget>? actions,
Widget? cancel,
VoidCallback? onCancel,
ValueChanged<int>? onConfirm,
}) {
actions = actions ?? [];
List<CupertinoActionSheetAction> actionsList = [];
for (int i = 0; i < actions.length; i++) {
actionsList.add(
CupertinoActionSheetAction(
onPressed: () => onConfirm?.call(i),
child: actions[i],
),
);
}
Get.bottomSheet(
CupertinoActionSheet(
title: title,
message: content,
actions: actionsList,
cancelButton: CupertinoActionSheetAction(
onPressed: () => onCancel != null ? onCancel.call() : Get.back(),
child: cancel ?? Text('取消'.tr),
),
),
);
}