modalSellOn method

dynamic modalSellOn(
  1. BuildContext context, {
  2. String? title,
  3. String? message,
  4. dynamic onOke()?,
  5. dynamic onCancel()?,
  6. Color? colorOk,
  7. Color? colorNo,
  8. bool? barierDismisable,
  9. bool? alone,
})

Implementation

modalSellOn(BuildContext context,
    {String? title,
      String? message,
      Function()? onOke,
      Function()? onCancel,
      Color? colorOk,
      Color? colorNo,
      bool? barierDismisable,
      bool? alone}) {
  if (barierDismisable == null) {
    barierDismisable = true;
  }
  Widget cancelIosButton = CupertinoDialogAction(
    // isDestructiveAction : true,
    child: DefaultText(
      textLabel: "No",
      // textLabel: "No",
      colorsText: colorNo != null ? colorNo : Colors.blue,
    ),
    onPressed:
    onCancel != null ? onCancel : () => Navigator.of(context).pop(),
  );

  Widget proccessIosButton = CupertinoDialogAction(
    child: DefaultText(
      textLabel: alone != null
          ? "Ok"
          : "Yes",
      // textLabel: "Ok",
      colorsText: colorOk != null ? colorOk : Colors.red,
    ),
    onPressed: onOke,
  );

  CupertinoAlertDialog curpertionalertDialog = CupertinoAlertDialog(
    // title: DefaultText(
    //   textLabel: "Sellon",
    //   fontWeight: FontWeight.bold,
    //   sizeText: 16,
    // ),
    content: DefaultText(
      textLabel: message,
      colorsText: Colors.black,
    ),
    actions: alone != null
        ? [proccessIosButton]
        : [cancelIosButton, proccessIosButton],
  );

  // show the dialog
  showCupertinoDialog(
      context: context,
      barrierDismissible: barierDismisable,
      builder: (BuildContext context) {
        return WillPopScope(
            onWillPop: barierDismisable != null
                ? () async => false
                : () async => backContent(context, barierDismisable),
            child: curpertionalertDialog);
      });
}