commonWarningDialog static method

dynamic commonWarningDialog({
  1. required BuildContext context,
  2. required String title,
  3. required String subTitle,
  4. required String buttonText,
  5. required Color themeColor,
  6. required dynamic buttonOnTap(),
  7. required bool useMobileLayout,
})

Implementation

static commonWarningDialog(
    {required final BuildContext context,
    required String title,
    required String subTitle,
    required String buttonText,
    required Color themeColor,
    required Function() buttonOnTap,
    required bool useMobileLayout}) {
  showDialog(
    barrierDismissible: false,
    context: context,
    builder: (context) {
      return WillPopScope(
        onWillPop: () => Future.value(false),
        child: Dialog(
          backgroundColor: AppColors.transparent,
          child: Container(
              padding: const EdgeInsets.all(12),
              decoration: BoxDecoration(color: AppColors.white, borderRadius: BorderRadius.circular(10)),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisSize: MainAxisSize.min,
                children: [
                  const SizedBox(height: 8),
                  Text(
                    title,
                    style: TextStyle(fontSize: useMobileLayout ? 20 : 24, fontFamily: AppConstant.robotoText),
                  ),
                  const SizedBox(height: 10),
                  Text(
                    subTitle,
                    style: const TextStyle(fontSize: 15, fontFamily: AppConstant.robotoText),
                    textAlign: TextAlign.center,
                  ),
                  const SizedBox(height: 20),
                  InkWell(
                    onTap: buttonOnTap,
                    child: Container(
                      height: 50,
                      width: 100,
                      decoration:
                          BoxDecoration(color: themeColor, borderRadius: BorderRadius.circular(10)),
                      child: Center(
                          child: Text(
                        buttonText,
                        style: const TextStyle(color: AppColors.white, fontSize: 16),
                      )),
                    ),
                  ),
                  const SizedBox(height: 8)
                ],
              )),
        ),
      );
    },
  );
}