import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import '../../../core/constants/app_assets.dart';
import '../../../core/constants/translation_keys.dart';
import '../../../custom_widgets/custom_app_bar.dart';
import '../../../custom_widgets/custom_button.dart';
import '../../../res/app_colors.dart';
import '../../../routes/app_pages.dart';
import '../controllers/cheque_book_request_details_controller.dart';

class ChequeBookRequestDetailsView
    extends GetView<ChequeBookRequestDetailsController> {
  const ChequeBookRequestDetailsView({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: DashBoardAppBar(
        title: TranslationKeys.makeTranslation(
            TranslationKeys.textChequeRequestDetail),
        onBackButtonPressed: () {
          Get.back();
        },
      ),
      persistentFooterButtons: [
        Padding(
          padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
          child: CustomButton(
            buttonColor: AppColors.colorButton,
            onPressed: () {
              Get.offAllNamed(Routes.DASHBOARD_SCREEN);
            },
            buttonText:
                TranslationKeys.makeTranslation(TranslationKeys.textNext),
            buttonPadding:
                const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
          ),
        ),
      ],
      body: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(
                TranslationKeys.makeTranslation(
                    TranslationKeys.textChequeBookRequestContent),
                style: Theme.of(context).textTheme.bodyMedium?.copyWith(
                    fontSize: 14,
                    color: AppColors.colorText,
                    fontWeight: FontWeight.w400)),
            const SizedBox(height: 20),
            Container(
              padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  border: Border.all(color: AppColors.colorGrey350)),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text(
                          TranslationKeys.makeTranslation(
                              TranslationKeys.textLeave20),
                          style: Theme.of(context)
                              .textTheme
                              .titleLarge
                              ?.copyWith(
                                  fontWeight: FontWeight.w600, fontSize: 28)),
                      InkWell(
                        onTap: () {
                          Get.back();
                        },
                        child: Container(
                          decoration: BoxDecoration(
                            color: AppColors.colorButton,
                            borderRadius: BorderRadius.circular(50),
                          ),
                          child: Padding(
                            padding: const EdgeInsets.symmetric(
                                horizontal: 15.0, vertical: 4),
                            child: Text(
                                TranslationKeys.makeTranslation(
                                    TranslationKeys.textChange),
                                style: Theme.of(context)
                                    .textTheme
                                    .bodySmall
                                    ?.copyWith(color: AppColors.white)),
                          ),
                        ),
                      ),
                    ],
                  ),
                  const SizedBox(height: 10),
                  Text(
                      TranslationKeys.makeTranslation(
                          TranslationKeys.textLeaves),
                      style: Theme.of(context)
                          .textTheme
                          .bodySmall
                          ?.copyWith(color: AppColors.colorGrey800)),
                  const SizedBox(height: 10),
                  Text(
                      TranslationKeys.makeTranslation(
                          TranslationKeys.textDeliveryAddress),
                      style: Theme.of(context)
                          .textTheme
                          .titleSmall
                          ?.copyWith(color: AppColors.colorGrey800)),
                  const SizedBox(height: 10),
                  Text(
                      TranslationKeys.makeTranslation(
                          TranslationKeys.textChequeBookRequestAddress),
                      style: Theme.of(context)
                          .textTheme
                          .bodySmall
                          ?.copyWith(color: AppColors.colorGrey800)),
                  const SizedBox(height: 10),
                  Text(
                      TranslationKeys.makeTranslation(
                          TranslationKeys.textCharges),
                      style: Theme.of(context)
                          .textTheme
                          .titleSmall
                          ?.copyWith(color: AppColors.colorGrey800)),
                  const SizedBox(height: 10),
                  Text(
                      TranslationKeys.makeTranslation(
                          TranslationKeys.textScheduleCharges),
                      style: Theme.of(context)
                          .textTheme
                          .bodySmall
                          ?.copyWith(color: AppColors.colorGrey800)),
                  const SizedBox(height: 10),
                  Text(
                      TranslationKeys.makeTranslation(TranslationKeys.textDate),
                      style: Theme.of(context)
                          .textTheme
                          .titleSmall
                          ?.copyWith(color: AppColors.colorGrey800)),
                  const SizedBox(height: 10),
                  Text(
                      TranslationKeys.makeTranslation(
                          TranslationKeys.textDateContent),
                      style: Theme.of(context)
                          .textTheme
                          .bodySmall
                          ?.copyWith(color: AppColors.colorGrey800)),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }

  /// SuccessFull Dialog...........Transactions
  void showTransactionSuccess(BuildContext context) {
    Get.dialog(
        Dialog(
          shape:
              RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
          child: SingleChildScrollView(
            child: Padding(
              padding: const EdgeInsets.all(2),
              child: ListView(
                physics: const NeverScrollableScrollPhysics(),
                shrinkWrap: true,
                children: [
                  Column(
                    children: [
                      Align(
                        alignment: Alignment.topRight,
                        child: InkWell(
                          onTap: () {
                            Navigator.of(context, rootNavigator: true).pop();
                          },
                          child: SvgPicture.asset(
                            AppAssets.ic_close,
                            height: 67,
                            width: 67,
                          ),
                        ),
                      ),
                      const SizedBox(height: 10),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 0, vertical: 0),
                        child: Text(
                            TranslationKeys.makeTranslation(
                                TranslationKeys.textRequestSummary),
                            style: Theme.of(context)
                                .textTheme
                                .titleMedium
                                ?.copyWith(
                                    fontWeight: FontWeight.w700, fontSize: 24)),
                      ),
                      const SizedBox(height: 8),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 0, vertical: 5),
                        child: Text(
                            TranslationKeys.makeTranslation(
                                TranslationKeys.textNumberofLeaves),
                            style: Theme.of(context)
                                .textTheme
                                .bodySmall
                                ?.copyWith(
                                    fontWeight: FontWeight.w400, fontSize: 16)),
                      ),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 0, vertical: 5),
                        child: Text(
                            TranslationKeys.makeTranslation(
                                TranslationKeys.textLeave20),
                            style: Theme.of(context)
                                .textTheme
                                .titleLarge
                                ?.copyWith(
                                    fontWeight: FontWeight.w600, fontSize: 22)),
                      ),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 0, vertical: 0),
                        child: Text(
                            TranslationKeys.makeTranslation(
                                TranslationKeys.textDeliveryAddress),
                            style: Theme.of(context)
                                .textTheme
                                .bodySmall
                                ?.copyWith(
                                    fontWeight: FontWeight.w400, fontSize: 16)),
                      ),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 20, vertical: 5),
                        child: Text(
                            TranslationKeys.makeTranslation(
                                TranslationKeys.textChequeBookRequestAddress),
                            style: Theme.of(context)
                                .textTheme
                                .bodySmall
                                ?.copyWith(
                                    fontWeight: FontWeight.w400, fontSize: 12)),
                      ),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 0, vertical: 5),
                        child: Text(
                            TranslationKeys.makeTranslation(
                                TranslationKeys.textCharges),
                            style: Theme.of(context)
                                .textTheme
                                .bodySmall
                                ?.copyWith(
                                    fontWeight: FontWeight.w400, fontSize: 16)),
                      ),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 0, vertical: 5),
                        child: Text(
                            TranslationKeys.makeTranslation(
                                TranslationKeys.textScheduleCharges),
                            style: Theme.of(context)
                                .textTheme
                                .bodySmall
                                ?.copyWith(
                                    fontWeight: FontWeight.w400, fontSize: 16)),
                      ),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 0, vertical: 5),
                        child: Text(
                            TranslationKeys.makeTranslation(
                                TranslationKeys.textDate),
                            style: Theme.of(context)
                                .textTheme
                                .bodySmall
                                ?.copyWith(
                                    fontWeight: FontWeight.w400, fontSize: 16)),
                      ),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 0, vertical: 5),
                        child: Text(
                            TranslationKeys.makeTranslation(
                                TranslationKeys.textDateContent),
                            style: Theme.of(context)
                                .textTheme
                                .bodySmall
                                ?.copyWith(
                                    fontWeight: FontWeight.w400, fontSize: 16)),
                      ),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 10, vertical: 10),
                        child: Text(
                            TranslationKeys.makeTranslation(
                                TranslationKeys.textQueryContent),
                            style: Theme.of(context)
                                .textTheme
                                .bodySmall
                                ?.copyWith(
                                    fontWeight: FontWeight.w400,
                                    fontSize: 10,
                                    color: AppColors.colorGrey800)),
                      ),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 20, vertical: 10),
                        child: CustomButton(
                          buttonColor: AppColors.colorPrimaryLight,
                          onPressed: () {
                            Navigator.of(context, rootNavigator: true).pop();
                            Get.offAndToNamed(Routes.CHEQUE_MANAGEMENT);
                          },
                          buttonText: TranslationKeys.makeTranslation(
                              TranslationKeys.textDeposit),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ),
        ),
        barrierDismissible: false);
  }
}
