import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:gap/gap.dart';
import 'package:tanami_app/core/routes/routes.dart';
import 'package:tanami_app/core/styles/app_color.dart';
import 'package:tanami_app/core/styles/app_images.dart';
import 'package:tanami_app/core/styles/app_text.dart';

import 'text_widget.dart';

exitAppDialog(
  context,
) {
  return showDialog(
    context: context,
    builder: (context) => Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        AlertDialog(
          insetPadding: const EdgeInsets.symmetric(horizontal: 16),
          backgroundColor: AppColor.plainWhite,
          shape: const RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(20)),
            side: BorderSide(
              color: AppColor.plainWhite,
            ),
          ),
          content: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Align(
                alignment: Alignment.center,
                child: CircleAvatar(
                  radius: 25,
                  backgroundColor: AppColor.inactiveBtnColor,
                  child: Center(
                    child: SvgPicture.asset(
                      AppImages.exitAppIcon,
                      width: 30,
                      height: 30,
                      fit: BoxFit.contain,
                      color: AppColor.primaryColor,
                    ),
                  ),
                ),
              ),
              SizedBox(
                height: 22.h,
              ),
              Align(
                alignment: Alignment.center,
                child: Container(
                  margin: const EdgeInsets.symmetric(horizontal: 30),
                  child: TextWidget().text17W700(
                    AppText.areYouSureYouWantToExitText,
                    clr: AppColor.textLabelColor,
                  ),
                ),
              ),
              Gap(21.h),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: [
                  GestureDetector(
                    onTap: () {
                      goRouter.pop();
                    },
                    child: Container(
                      height: 48.h,
                      width: 140.w,
                      decoration: BoxDecoration(
                        border: Border.all(
                          color: AppColor.primaryColor,
                        ),
                        borderRadius: BorderRadius.circular(10.h),
                        color: AppColor.plainWhite,
                      ),
                      child: Center(
                        child: TextWidget().text18W700(
                          AppText.cancelText,
                          clr: AppColor.primaryColor2,
                        ),
                      ),
                    ),
                  ),
                  Gap(15.w),
                  GestureDetector(
                    onTap: () {
                      SystemNavigator.pop();
                      Navigator.pop(context);
                    },
                    child: Container(
                      height: 48.h,
                      width: 140.w,
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(10.h),
                          color: AppColor.primaryColor),
                      child: Center(
                        child: TextWidget().text18W700(
                          AppText.exitText,
                          clr: AppColor.plainWhite,
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            ],
          ),
        ),
      ],
    ),
  );
}
