showNonSupportAlert static method

Future showNonSupportAlert({
  1. required BuildContext context,
  2. required AppticsAppUpdateNotSupported appUpdateData,
  3. required void onClick(),
})

Implementation

static Future showNonSupportAlert({
  required BuildContext context,
  required AppticsAppUpdateNotSupported appUpdateData,
  required void Function() onClick,
}) {
  List<Widget>? actionWidget;

  if (appUpdateData.alertType == 1) {
    actionWidget = [
      TextButton(
        style: TextButton.styleFrom(
          textStyle: Theme.of(context).textTheme.labelLarge,
        ),
        child: Text(appUpdateData.continueBtTxt),
        onPressed: () {
          onClick();
          Navigator.of(context).pop();
        },
      )
    ];
  } else {
    actionWidget = null;
  }
  return showDialog(
      context: context,
      barrierDismissible: false,
      useRootNavigator: false,
      builder: (context) {
        return WillPopScope(
            child: AlertDialog(
              title: Text(appUpdateData.title),
              content: SingleChildScrollView(
                  child: Text(appUpdateData.description)),
              actions: actionWidget,
            ),
            onWillPop: () async {
              SystemNavigator.pop();
              return false;
            });
      });
}