notificationPermissionDialog static method

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

Implementation

static Future<bool> notificationPermissionDialog(
    {required String icon,
    required String title,
    required String message,
    required BuildContext context}) async {
  return await showDialog(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          contentPadding: EdgeInsets.zero,
          content: PopScope(
            canPop: false,
            onPopInvoked: (didPop) {
              if (didPop) {
                return;
              }
              // Get.back(result: false);
              Navigator.pop(context, false);
            },
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Container(
                  padding: const EdgeInsets.symmetric(vertical: 35.0),
                  child: Center(
                      child: CircleAvatar(
                    backgroundColor: buttonBgColor,
                    radius: 30,
                    child: SvgPicture.asset(
                      notificationAlertPermission,
                      package: package,
                    ),
                  )),
                ),
                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: MirrorflyUikit.getTheme?.primaryColor,
                  padding: const EdgeInsets.symmetric(horizontal: 8),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: [
                      TextButton(
                          onPressed: () {
                            // Get.back(result: false);
                            Navigator.pop(context, false);
                            // notNowBtn();
                          },
                          child: const Text(
                            "NOT NOW",
                            style: TextStyle(
                              color: buttonBgColor,
                              fontSize: 14,
                              fontWeight: FontWeight.w800,
                            ),
                          )),
                      TextButton(
                          onPressed: () {
                            // Get.back(result: true);
                            Navigator.pop(context, true);
                            // continueBtn();
                          },
                          child: const Text("TURN ON",
                              style: TextStyle(
                                color: buttonBgColor,
                                fontSize: 14,
                                fontWeight: FontWeight.w800,
                                fontFamily: 'sf_ui',
                              )))
                    ],
                  ),
                )
              ],
            ),
          ),
        );
      });
}