showActionSheet static method

dynamic showActionSheet(
  1. BuildContext context,
  2. List<AlertAction> actions
)

Implementation

static showActionSheet(BuildContext context, List<AlertAction> actions) {
  showCupertinoModalPopup(
    context: context,
    builder: (BuildContext context) {
      return CupertinoActionSheet(
        cancelButton: CupertinoActionSheetAction(
          onPressed: () {
            Navigator.pop(context);
          },
          child: Text(AlertView.defaultCancelTitle),
        ),
        actions: actions
            .map((e) => CupertinoActionSheetAction(
                  onPressed: () {
                    Navigator.of(context).pop();
                    e.onPressed();
                  },
                  child: Text(e.title),
                ))
            .toList(),
      );
    },
  );
}