showCupertinoDialog method

void showCupertinoDialog(
  1. BuildContext context
)

Implementation

void showCupertinoDialog(BuildContext context) {
  showDialog(
    context: context,
    builder: (BuildContext context) {
      isAlertActive = true;
      return CupertinoAlertDialog(
        title: Text('No Internet Connection'),
        content: customNoInternetText ??
            Text('Please check your internet connection and try again.'),
        actions: [
          CupertinoDialogAction(
            onPressed: () {
              isInternetBack(internetStatus: (status) {
                if (status) {
                  isAlertActive = false;
                  Navigator.pop(context);
                } else {
                  Navigator.pop(context);

                  Future.delayed(Duration(seconds: 1), () {
                    showPlatformAlert();
                  });
                }
              });
            },
            child: Text('Try Again'),
          ),
        ],
      );
    },
  );
}