import 'package:flutter/material.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:get/get_navigation/get_navigation.dart';
import 'package:permission_handler/permission_handler.dart';

import 'app_colors.dart';
import 'primary_button.dart';
import 'primary_text.dart';

void showPermissionAlertDialog({
  String title = "Need Permission",
  required String requestMsg,
  bool barrierDismissible = true,
}) {
  Get.defaultDialog(
    title: title,
    middleText: "",
    backgroundColor: Colors.white,
    contentPadding: const EdgeInsets.only(top: 30, bottom: 30.0),
    radius: 10,
    barrierDismissible: barrierDismissible,
    titlePadding: const EdgeInsets.only(top: 15),
    titleStyle: const TextStyle(
      color: AppColors.grey900Color,
      fontSize: 18,
      fontWeight: FontWeight.w600,
    ),
    /*cancel: PrimaryButton(
                              title: "DISMISS",
                              onPressed: () {},
                              textSize: AppSizes.font_13,
                              bgColor: AppColors.grey500Color,
                            ),*/
    confirm: PrimaryButton(
      title: "GO TO SETTINGS",
      onPressed: () {
        openAppSettings();
        Get.back();
      },
      textSize: 13,
    ),
    content: Padding(
      padding: const EdgeInsets.symmetric(horizontal: 8.0),
      child: PrimaryText(
        requestMsg,
        textAlign: TextAlign.center,
        fontColor: AppColors.grey800Color,
        fontSize: 15,
        fontWeight: FontWeight.w500,
      ),
    ),
  );
}
