notificationPermissionDialog static method

Future<bool> notificationPermissionDialog({
  1. required String icon,
  2. required String title,
  3. required String message,
})

Implementation

static Future<bool> notificationPermissionDialog(
    {required String icon,
    required String title,
    required String message}) async {
  return await DialogUtils.createDialog(AlertDialog(
    contentPadding: EdgeInsets.zero,
    content: PopScope(
      canPop: false,
      onPopInvokedWithResult: (didPop, result) {
        if (didPop) {
          return;
        }
        NavUtils.back(result: false);
      },
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Container(
            padding: const EdgeInsets.symmetric(vertical: 35.0),
            child: Center(
                child: CircleAvatar(
              backgroundColor: buttonBgColor,
              radius: 30,
              child: AppUtils.svgIcon(icon: notificationAlertPermission),
            )),
          ),
          Padding(
            padding: const EdgeInsets.all(16.0),
            child: Text(
              title,
              style: const TextStyle(fontSize: 14, color: textHintColor),
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(16.0),
            child: Text(
              message,
              textAlign: TextAlign.center,
              style: const TextStyle(
                fontSize: 14,
                color: textColor,
              ),
            ),
          ),
          Container(
            color: notificationAlertBg,
            padding: const EdgeInsets.symmetric(horizontal: 8),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.end,
              children: [
                TextButton(
                    onPressed: () {
                      NavUtils.back(result: false);
                      // notNowBtn();
                    },
                    child: Text(
                      getTranslated("notNow").toUpperCase(),
                      style: const TextStyle(
                        color: buttonBgColor,
                        fontSize: 14,
                        fontWeight: FontWeight.w800,
                      ),
                    )),
                TextButton(
                    onPressed: () {
                      NavUtils.back(result: true);
                      // continueBtn();
                    },
                    child: Text(getTranslated("turnOn").toUpperCase(),
                        style: const TextStyle(
                          color: buttonBgColor,
                          fontSize: 14,
                          fontWeight: FontWeight.w800,
                          fontFamily: 'sf_ui',
                        )))
              ],
            ),
          )
        ],
      ),
    ),
  ));
}