showIosDialog<T> static method
Future<T?>
showIosDialog<
T>( - dynamic context, {
- dynamic showCancel = true,
- List<TextClick<T?>>? textClick,
})
Implementation
static Future<T?> showIosDialog<T>(context,
{showCancel = true, List<TextClick<T?>>? textClick}) {
List<CupertinoActionSheetAction> list = [];
textClick?.forEach((element) {
if (element.text == null) return;
list.add(CupertinoActionSheetAction(
isDestructiveAction: element.red,
onPressed: () {
Navigator.pop(context, element.returnValue);
if (element.fun != null) element.fun!();
},
child: Text(element.text ?? '')));
});
return showCupertinoModalPopup<T>(
context: context,
builder: (c) {
return CupertinoActionSheet(
actions: list,
cancelButton: showCancel
? CupertinoActionSheetAction(
//取消按钮
onPressed: () {
Navigator.pop(context);
},
child: Text('cancel'),
)
: null,
);
});
}