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 '../../../res/app_colors.dart';
import '../../../routes/app_pages.dart';
import '../../login/views/shared/bottom_sheet_login.dart';
import '../controllers/cheque_management_controller.dart';

class ChequeManagementView extends GetView<ChequeManagementController> {
  const ChequeManagementView({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: DashBoardAppBar(
        title: TranslationKeys.makeTranslation(TranslationKeys.textChequeManagement),
        onBackButtonPressed: () {
          Get.back();
        },
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 10),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Wrap(
                children: [
                  GridView.builder(
                      padding: const EdgeInsets.only(left: 15, right: 15, top: 0, bottom: 15),
                      itemCount: options.length,
                      shrinkWrap: true,
                      physics: const NeverScrollableScrollPhysics(),
                      itemBuilder: (context, index) {
                        BottomSheetLogin bottomSheetLogin = options[index];
                        return InkWell(
                            customBorder: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(10),
                            ),
                            onTap: bottomSheetLogin.onTap,
                            child: Container(
                                padding: const EdgeInsets.all(8),
                                alignment: Alignment.center,
                                decoration: BoxDecoration(border: Border.all(color: AppColors.colorGrey350, width: 1), borderRadius: const BorderRadius.all(Radius.circular(10))),
                                child: Column(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  children: [
                                    SvgPicture.asset(
                                     bottomSheetLogin.icon,
                                      width: 50,
                                    ),
                                    const SizedBox(height: 10),
                                    Center(
                                      child: Text(bottomSheetLogin.description, style: Theme.of(context).textTheme.titleSmall),
                                    ),
                                  ],
                                )));
                      },
                      gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
                        childAspectRatio: 0.4 / 0.3,
                        crossAxisCount: 2,
                        crossAxisSpacing: 10,
                        mainAxisSpacing: 10,
                      )),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }

  static List<BottomSheetLogin> options = [
    BottomSheetLogin(
        description: TranslationKeys.makeTranslation(TranslationKeys.textChequeStatus),
        icon: AppAssets.ic_check_status,
        onTap: () {
          Get.toNamed(Routes.CHEQUE_STATUS);
        }),
    BottomSheetLogin(
        description: TranslationKeys.makeTranslation(TranslationKeys.textChequeDeposit),
        icon: AppAssets.ic_cheque_deposit,
        onTap: () {
          Get.toNamed(Routes.CHEQUE_DEPOSIT);
        }),
    BottomSheetLogin(
        description: TranslationKeys.makeTranslation(TranslationKeys.textChequeActivation),
        icon: AppAssets.ic_activation,
        onTap: () {
          Get.toNamed(Routes.CHEQUE_ACTIVATION);
        }),
    BottomSheetLogin(
        description: TranslationKeys.makeTranslation(TranslationKeys.textChequeRequest),
        icon: AppAssets.ic_request,
        onTap: () {
          Get.toNamed(Routes.CHEQUE_REQUEST);
        }),
  ];
}
