// import 'package:flutter/material.dart';
//
// import 'package:get/get.dart';
// import 'package:uco_ciihive/app/core/constants/app_assets.dart';
// import 'package:uco_ciihive/app/core/constants/translation_keys.dart';
// import 'package:uco_ciihive/app/modules/dashboard/controllers/dashboard_screen_controller.dart';
// import 'package:uco_ciihive/app/modules/user_profile/controllers/user_profile_controller.dart';
// import 'package:uco_ciihive/app/res/app_colors.dart';
// import 'package:uco_ciihive/app/res/app_dimensions.dart';
// import 'package:uco_ciihive/app/routes/app_pages.dart';
//
// import 'bottom_sheet_icon.dart';
//
// class DashBoardWithAllAccounts extends GetView<DashboardScreenController> {
//   late MenuController? menuController;
//
//   DashBoardWithAllAccounts({super.key, this.menuController});
//
//   final DashboardScreenController dashBoardController = Get.find<DashboardScreenController>();
//
//   @override
//   Widget build(BuildContext Get.context!) {
//     controller.Get.context! = Get.context!;
//     return Scaffold(
//       floatingActionButton: Padding(
//         padding: EdgeInsets.symmetric(vertical: 20, horizontal: 30),
//         child: SpeedDial(
//           openBackgroundColor: AppColors.colorButton,
//           closedBackgroundColor: AppColors.colorPrimaryLight,
//           labelsBackgroundColor: AppColors.colorButton,
//           labelsStyle: Theme.of(Get.context!).textTheme.bodyMedium?.copyWith(color: AppColors.colorPrimary),
//           speedDialChildren: [
//             SpeedDialChild(
//               backgroundColor: AppColors.colorButton,
//               label: TranslationKeys.makeTranslation(TranslationKeys.textLogin),
//               child: Padding(
//                 padding: const EdgeInsets.all(2.0),
//                 child: SvgPicture.asset(
//                   AppAssets.ic_u_send,
//                   color: Colors.white,
//                 ),
//               ),
//               onPressed: () {
//                 //Get.toNamed(Routes.DIRECT_PAYMENT);
//               },
//             ),
//             SpeedDialChild(
//               backgroundColor: AppColors.colorButton,
//               label: TranslationKeys.makeTranslation(TranslationKeys.textLogin),
//               child: Padding(
//                 padding: const EdgeInsets.all(8.0),
//                 child: SvgPicture.asset(
//                   AppAssets.ic_u_send,
//                   color: Colors.white,
//                 ),
//               ),
//               onPressed: () {
//                 //Get.toNamed(Routes.NEW_BENEFICIARY);
//               },
//             ),
//             SpeedDialChild(
//               backgroundColor: AppColors.colorButton,
//               label: TranslationKeys.makeTranslation(TranslationKeys.textLogin),
//               child: Padding(
//                 padding: const EdgeInsets.all(8.0),
//                 child: SvgPicture.asset(
//                   AppAssets.ic_u_send,
//                   color: Colors.white,
//                 ),
//               ),
//               onPressed: () {
//                 // Get.toNamed(Routes.OWN_TRANSFER);
//               },
//             ),
//             SpeedDialChild(
//               backgroundColor: AppColors.colorButton,
//               label: TranslationKeys.makeTranslation(TranslationKeys.textLogin),
//               child: Padding(
//                 padding: const EdgeInsets.all(8.0),
//                 child: SvgPicture.asset(
//                   AppAssets.ic_u_send,
//                   color: Colors.white,
//                 ),
//               ),
//               onPressed: () {
//                 //Get.toNamed(Routes.ZAKAT);
//               },
//             ),
//           ],
//           child: CustomText(TranslationKeys.makeTranslation(TranslationKeys.textHelp), style: Theme.of(Get.context!).textTheme.titleSmall?.copyWith(fontSize: 11, color: AppColors.colorSecondary)),
//         ),
//       ),
//       body: Column(
//         children: [
//           Expanded(
//             child: SingleChildScrollView(
//               child: Column(
//                 children: [
//                   Stack(
//                     children: [
//                       Container(
//                         height: 60,
//                         color: AppColors.colorPrimary,
//                       ),
//                       Align(
//                         alignment: Alignment.center,
//                         child: Padding(
//                           padding: EdgeInsets.only(top: 20),
//                           child: CircleAvatar(
//                             radius: 40.0,
//                             child: SvgPicture.asset(
//                               AppAssets.lg_round_uc_logo,
//                               height: 100,
//                               width: 100,
//                               fit: BoxFit.cover,
//                             ),
//                           ),
//                         ),
//                       ),
//                     ],
//                   ),
//                   SizedBox(height: 10),
//                   CustomText(TranslationKeys.makeTranslation(TranslationKeys.textDashboardWelcomeUser), style: Theme.of(Get.context!).textTheme.titleMedium),
//                   SizedBox(height: 10),
//                   Stack(
//                     children: [
//                       Align(
//                         alignment: Alignment.center,
//                         child: Container(
//                           height: 230,
//                           width: 188,
//                           decoration: BoxDecoration(
//                             color: AppColors.colorGrey100,
//                             border: Border.all(color: AppColors.colorText.withOpacity(0.1), width: 1),
//                             borderRadius: BorderRadius.all(Radius.circular(AppDimensions.radiusCard)),
//                           ),
//                         ),
//                       ),
//                       Align(
//                         alignment: Alignment.center,
//                         child: Padding(
//                           padding: EdgeInsets.only(top: 15.0),
//                           child: Container(
//                             height: 225,
//                             width: 188,
//                             decoration: BoxDecoration(
//                               color: AppColors.colorGrey200,
//                               border: Border.all(color: AppColors.colorText.withOpacity(0.2), width: 1),
//                               borderRadius: BorderRadius.all(Radius.circular(AppDimensions.radiusCard)),
//                             ),
//                           ),
//                         ),
//                       ),
//                       Align(
//                         alignment: Alignment.center,
//                         child: Padding(
//                           padding: EdgeInsets.all(30.0),
//                           child: Container(
//                             height: 200,
//                             width: 212,
//                             decoration: BoxDecoration(
//                               color: AppColors.colorGrey50,
//                               border: Border.all(color: AppColors.colorButton, width: 2),
//                               borderRadius: BorderRadius.all(Radius.circular(AppDimensions.radiusCard)),
//                             ),
//                           ),
//                         ),
//                       ),
//                       Align(
//                         alignment: Alignment.center,
//                         child: Padding(
//                           padding: EdgeInsets.only(top: 40.0),
//                           child: Container(
//                             height: 179,
//                             width: 190,
//                             decoration: BoxDecoration(
//                               color: AppColors.colorGrey50,
//                               border: Border.all(color: AppColors.colorPrimary, width: 2),
//                               borderRadius: BorderRadius.all(Radius.circular(AppDimensions.radiusCard)),
//                             ),
//                             child: Padding(
//                               padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20),
//                               child: Column(
//                                 mainAxisAlignment: MainAxisAlignment.center,
//                                 children: [
//                                   CustomText(TranslationKeys.makeTranslation(TranslationKeys.textTotalAvailableFunds), style: Theme.of(Get.context!).textTheme.bodySmall),
//                                   SizedBox(height: 5),
//                                   CustomText(TranslationKeys.makeTranslation(TranslationKeys.textTotalAvailableBalance), style: Theme.of(Get.context!).textTheme.titleLarge),
//                                   SizedBox(height: 5),
//                                   CustomText(TranslationKeys.makeTranslation(TranslationKeys.textTotalAvailableBalanceInWords), style: Theme.of(Get.context!).textTheme.bodySmall),
//                                   SizedBox(height: 5),
//                                   CustomText(TranslationKeys.makeTranslation(TranslationKeys.textAccountNumber), style: Theme.of(Get.context!).textTheme.bodySmall),
//                                 ],
//                               ),
//                             ),
//                           ),
//                         ),
//                       ),
//                     ],
//                   ),
//                   SizedBox(height: 5),
//                   Stack(
//                     children: [
//                       InkWell(
//                         onTap: () {
//                           Get.toNamed(Routes.TRANSACTION_HISTORY);
//                         },
//                         child: Padding(
//                           padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 0.0),
//                           child: Container(
//                             color: AppColors.colorGrey300,
//                             child: Row(
//                               children: <Widget>[
//                                 Column(children: [
//                                   Container(
//                                     decoration: const BoxDecoration(
//                                       color: AppColors.colorPrimary,
//                                       borderRadius: BorderRadius.zero,
//                                     ),
//                                     child: Padding(
//                                       padding: const EdgeInsets.all(20.0),
//                                       child: SvgPicture.asset(AppAssets.img_debet, color: AppColors.colorSecondary),
//                                     ),
//                                   )
//                                 ]),
//                                 Padding(
//                                   padding: EdgeInsets.symmetric(horizontal: 20),
//                                   child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
//                                     CustomText(
//                                       "Current Account",
//                                       style: Theme.of(Get.context!).textTheme.titleSmall,
//                                     ),
//                                     SizedBox(height: 5),
//                                     CustomText(
//                                       "022379122*****95",
//                                       style: Theme.of(Get.context!).textTheme.bodySmall,
//                                     ),
//                                   ]),
//                                 ),
//                               ],
//                             ),
//                           ),
//                         ),
//                       ),
//                       Positioned(
//                         top: 20,
//                         right: 20,
//                         child: Align(
//                             alignment: Directionality.of(Get.context!) == TextDirection.rtl ? Alignment.bottomLeft : Alignment.bottomRight,
//                             child: Transform(
//                               alignment: Alignment.center,
//                               transform: Matrix4.rotationY(Directionality.of(Get.context!) == TextDirection.rtl ? 3.14159 : 0),
//                               child: SizedBox(
//                                   height: 40,
//                                   width: 40,
//                                   child: SvgPicture.asset(
//                                     fit: BoxFit.cover,
//                                     AppAssets.img_round_dashboard_card,
//                                     height: 35,
//                                     width: 35,
//                                   )),
//                             )),
//                       ),
//                     ],
//                   ),
//                   SizedBox(height: 20),
//                   Stack(
//                     children: [
//                       Padding(
//                         padding:  EdgeInsets.symmetric(horizontal: 20.0, vertical: 0.0),
//                         child: Container(
//                           color: AppColors.colorGrey300,
//                           child: Row(
//                             children: <Widget>[
//                               Column(children: [
//                                 Container(
//                                   decoration: const BoxDecoration(
//                                     color: AppColors.colorPrimary,
//                                     borderRadius: BorderRadius.zero,
//                                   ),
//                                   child: Padding(
//                                     padding: const EdgeInsets.all(20.0),
//                                     child: SvgPicture.asset(AppAssets.img_debet, color: AppColors.colorSecondary),
//                                   ),
//                                 )
//                               ]),
//                               Padding(
//                                 padding: EdgeInsets.symmetric(horizontal: 20),
//                                 child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
//                                   CustomText(
//                                     "Current Account",
//                                     style: Theme.of(Get.context!).textTheme.titleSmall,
//                                   ),
//                                   SizedBox(height: 5),
//                                   CustomText(
//                                     "022379122*****95",
//                                     style: Theme.of(Get.context!).textTheme.bodySmall,
//                                   ),
//                                 ]),
//                               ),
//                             ],
//                           ),
//                         ),
//                       ),
//                       Positioned(
//                         top: 20,
//                         right: 20,
//                         child: Align(
//                             alignment: Directionality.of(Get.context!) == TextDirection.rtl ? Alignment.bottomLeft : Alignment.bottomRight,
//                             child: Transform(
//                               alignment: Alignment.center,
//                               transform: Matrix4.rotationY(Directionality.of(Get.context!) == TextDirection.rtl ? 3.14159 : 0),
//                               child: SizedBox(
//                                   height: 40,
//                                   width: 40,
//                                   child: SvgPicture.asset(
//                                     fit: BoxFit.cover,
//                                     AppAssets.img_round_dashboard_card,
//                                     height: 35,
//                                     width: 35,
//                                   )),
//                             )),
//                       ),
//                     ],
//                   ),
//                 ],
//               ),
//             ),
//           ),
//           Container(
//             padding: EdgeInsets.symmetric(horizontal: 20),
//             child: Stack(
//               alignment: Alignment.bottomCenter,
//               children: [
//                 Container(
//                   padding: EdgeInsets.symmetric(horizontal: 30, vertical: 10),
//                   margin: EdgeInsets.only(bottom: 10),
//                   width: double.infinity,
//                   decoration: BoxDecoration(
//                     color: AppColors.colorPrimary,
//                     borderRadius: BorderRadius.all(
//                       Radius.circular(10),
//                     ),
//                   ),
//                   child: Row(
//                     mainAxisAlignment: MainAxisAlignment.spaceBetween,
//                     children: [
//                       BottomSheetIcon(
//                         title: TranslationKeys.makeTranslation(TranslationKeys.textLogin),
//                         imageProvider: AppAssets.ic_u_send,
//                         onTap: () {},
//                       ),
//                       BottomSheetIcon(
//                         title: TranslationKeys.makeTranslation(TranslationKeys.textLogin),
//                         imageProvider: AppAssets.ic_u_send,
//                         onTap: () {},
//                       ),
//                       BottomSheetIcon(
//                         title: TranslationKeys.makeTranslation(TranslationKeys.textLogin),
//                         imageProvider: AppAssets.ic_u_send,
//                         onTap: () {},
//                       ),
//                       SizedBox(width: 20),
//                       /*  const SizedBox()*/
//                     ],
//                   ),
//                 ),
//               ],
//             ),
//           )
//         ],
//       ),
//     );
//   }
// }
// =======

import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.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 '../../../../core/utils/SessionCache.dart';
import '../../../../core/utils/logs_utils.dart';
import '../../../../custom_widgets/custom_no_record.dart';
import '../../../../custom_widgets/custom_text.dart';
import '../../../../res/app_colors.dart';
import '../../../../routes/app_pages.dart';
import '../../../speed_dial/src/simple_speed_dial.dart';
import '../../../u_received/views/u_received_view.dart';
import '../../../u_send/views/u_send_view.dart';
import '../../controllers/dashboard_screen_controller.dart';
import 'bottom_sheet_icon.dart';

class DashBoardWithAllAccounts extends GetView<DashboardScreenController> {
  late MenuController? menuController;

  DashBoardWithAllAccounts({super.key, this.menuController});

  final DashboardScreenController dashBoardController = Get.find<DashboardScreenController>();

  List<Widget> widgetList = [
    const DashBoardPage(),
    const USendView(showAppBar: false),
    const UReceivedView(showAppBar: false),
    const Center(
      child: CustomNoRecord(title: "No Record Found",
          description: "We couldn't find any activity at this moment"),
    )
  ];

  @override
  Widget build(BuildContext context) {
    controller.context = context;

    return KeyboardVisibilityBuilder(builder: (context, isKeyboardOpen) {
      dp("OPen is", isKeyboardOpen);

      return Scaffold(
        resizeToAvoidBottomInset: false,
        floatingActionButton: isKeyboardOpen ? null : mainFloatingButton(),
        floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
        bottomNavigationBar: isKeyboardOpen
            ? null
            : Container(
                height: 55,
                clipBehavior: Clip.none,
                padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 0),
                margin: const EdgeInsets.only(bottom: 10, right: 20, left: 20),
                decoration: const BoxDecoration(
                  color: AppColors.colorPrimary,
                  borderRadius: BorderRadius.all(Radius.circular(10)),
                ),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    BottomSheetIcon(
                      title: TranslationKeys.makeTranslation(TranslationKeys.textHome),
                      imageProvider: AppAssets.ic_home_icon,
                      onTap: () {
                        dp("Click", " home dash board");
                        controller.updatePage(0);
                      },
                      width: 25,
                      height: 25,
                    ),
                    BottomSheetIcon(
                      title: TranslationKeys.makeTranslation(TranslationKeys.textUSend),
                      imageProvider: AppAssets.ic_u_cash,
                      onTap: () {
                        dp("Click", " home dash board");
                        controller.updatePage(1);
                      },
                      width: 25,
                      height: 25,
                    ),
                    BottomSheetIcon(
                      title: TranslationKeys.makeTranslation(TranslationKeys.textReceived),
                      imageProvider: AppAssets.ic_u_recive,
                      onTap: () {
                        controller.updatePage(2);
                      },
                      width: 25,
                      height: 25,
                    ),
                    BottomSheetIcon(
                      title: TranslationKeys.makeTranslation(TranslationKeys.textUShop),
                      imageProvider: AppAssets.ic_u_shop,
                      onTap: () {
                        controller.fetchDepositAccounts();

                        controller.fetchExchangeRates();

                        controller.updatePage(3);
                      },
                      width: 25,
                      height: 25,
                    ),
                    const SizedBox(width: 20),
                    /*  const SizedBox()*/
                  ],
                ),
              ),
        body: GetBuilder<DashboardScreenController>(
          builder: (controller) => widgetList[controller.curentIndex],
        ),
      );
    });
  }

  Widget mainFloatingButton() {
    return SpeedDial(
        openBackgroundColor: AppColors.colorButton,
        closedBackgroundColor: AppColors.colorPrimaryLight,
        labelsBackgroundColor: AppColors.colorButton,
        labelsStyle: Get.context!.textTheme.bodyMedium?.copyWith(
          color: AppColors.white,
          fontSize: 16,
          fontWeight: FontWeight.w600,
        ),
        speedDialChildren: [
          SpeedDialChild(
            backgroundColor: AppColors.colorButton,
            label: TranslationKeys.makeTranslation(TranslationKeys.textBillManagement),
            child: SvgPicture.asset(AppAssets.ic_bill),
            onPressed: () {
              Get.toNamed(Routes.BILL_MANAGEMENT);
            },
          ),
          SpeedDialChild(
            backgroundColor: AppColors.colorButton,
            label: TranslationKeys.makeTranslation(TranslationKeys.textAccountStatement),
            child: SvgPicture.asset(AppAssets.ic_money_management),
            onPressed: () {
              Get.toNamed(Routes.ACCOUNT_STATEMENT);
            },
          ),
          SpeedDialChild(
            backgroundColor: AppColors.colorButton,
            label: TranslationKeys.makeTranslation(TranslationKeys.textUserActivity),
            child: SvgPicture.asset(AppAssets.ic_activity),
            onPressed: () {
              Get.toNamed(Routes.USER_ACTIVITY);
            },
          ),
          SpeedDialChild(
            backgroundColor: AppColors.colorButton,
            label: TranslationKeys.makeTranslation(TranslationKeys.textAddBeneficiary),
            child: SvgPicture.asset(AppAssets.ic_u_recive, color: AppColors.colorPrimary),
            onPressed: () {
              Get.toNamed(Routes.BENEFICIARY_MANAGEMENT);
            },
          ),
        ],
        child: SvgPicture.asset(
          AppAssets.sending_icon,
        ));
  }
}

class DashBoardPage extends StatelessWidget {
  const DashBoardPage({super.key});

  @override
  Widget build(BuildContext context) {
    return GetBuilder<DashboardScreenController>(builder: (controller) {
      return Obx(() {
        return Column(
          children: [
            controller.depositeAccount.isEmpty
                ? const Center(
                    child: Text("Data not found please try again"),
                  )
                : Expanded(
                    child: Column(
                      children: [
                        Stack(
                          fit: StackFit.passthrough,
                          clipBehavior: Clip.none,
                          children: [
                            Container(
                              height: 60,
                              color: AppColors.colorPrimary,
                            ),
                            Align(
                              alignment: Alignment.center,
                              child: Padding(
                                padding: const EdgeInsets.only(top: 20),
                                child: SvgPicture.asset(AppAssets.ic_dashboard_logo, height: 89, width: 79, fit: BoxFit.cover),
                              ),
                            ),
                            const Positioned(bottom: -10, left: 0, right: 0, child: AddMoneyAndKyc()),
                          ],
                        ),
                        const SizedBox(height: 27),
                        Padding(
                          padding: const EdgeInsets.symmetric(horizontal: 30),
                          child: CustomText(
                            "Welcome ${SessionCache.instance.userInfo.name}",
                            style: context.textTheme.titleMedium!.copyWith(fontSize: 21, fontWeight: FontWeight.w400),
                            textAlign: TextAlign.center,
                          ),
                        ),
                        const SizedBox(height: 30),
                        SingleChildScrollView(
                          scrollDirection: Axis.horizontal,
                          padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              ...controller.depositeAccount
                                  .map((depositAccount) => InkWell(
                                      onTap: () {
                                        Get.toNamed(Routes.ACCOUNT_STATEMENT, arguments: {"accountNumber": depositAccount.mbmBkmsnumber});
                                      },
                                      child: Padding(
                                        padding: const EdgeInsets.symmetric(horizontal: 5.0),
                                        child: Container(
                                            padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
                                            decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), color: Colors.white, boxShadow: [
                                              BoxShadow(
                                                color: Colors.grey.withOpacity(0.3), // Adjust color and opacity
                                                spreadRadius: 2.0, // Adjust for shadow diffusion
                                                blurRadius: 4.0, // Adjust for shadow softness
                                                offset: const Offset(0, 2), // Adjust for shadow position (x, y)
                                              ),
                                              BoxShadow(
                                                color: Colors.grey.withOpacity(0.3), // Adjust color and opacity
                                                spreadRadius: 2.0, // Adjust for shadow diffusion
                                                blurRadius: 4.0, // Adjust for shadow softness
                                                offset: const Offset(0, 0), // Adjust for shadow position (x, y)
                                              ),
                                            ]),
                                            child: Row(
                                              mainAxisSize: MainAxisSize.min,
                                              crossAxisAlignment: CrossAxisAlignment.start,
                                              children: [
                                                Flexible(
                                                  // flex: 3,
                                                  child: Padding(
                                                    padding: const EdgeInsets.only(top: 30.0),
                                                    child: Column(
                                                      crossAxisAlignment: CrossAxisAlignment.start,
                                                      children: [
                                                        CustomText(
                                                          "Total Balance",
                                                          style: context.textTheme.bodyMedium!.copyWith(fontSize: 11, fontWeight: FontWeight.w400),
                                                        ),
                                                        const SizedBox(height: 8),
                                                        SizedBox(
                                                          width: 160,
                                                          child: AutoSizeText(
                                                            "${depositAccount.pcrCurrshort} ${depositAccount.mbmBkmsbalance.toStringAsFixed(2)}",
                                                            style: context.textTheme.bodyMedium!.copyWith(fontSize: 20, fontWeight: FontWeight.w400),
                                                            overflow: TextOverflow.ellipsis,
                                                          ),
                                                        ),
                                                      ],
                                                    ),
                                                  ),
                                                ),
                                                const SizedBox(width: 30),
                                                Flexible(
                                                  child: Column(
                                                    mainAxisSize: MainAxisSize.min,
                                                    mainAxisAlignment: MainAxisAlignment.start,
                                                    children: [Image.asset(controller.getFlagWithCurrencyCode(depositAccount.pcrCurrcode), width: 30, height: 30)],
                                                  ),
                                                )
                                              ],
                                            )),
                                      )))
                                  .toList(),
                              const SizedBox(width: 10),
                              InkWell(
                                onTap: () {
                                  Get.toNamed(Routes.ADD_NEW_ACCOUNT);
                                },
                                child: Container(
                                    padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 14.0),
                                    decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), color: Colors.white, boxShadow: [
                                      BoxShadow(
                                        color: Colors.grey.withOpacity(0.3), // Adjust color and opacity
                                        spreadRadius: 2.0, // Adjust for shadow diffusion
                                        blurRadius: 4.0, // Adjust for shadow softness
                                        offset: const Offset(0, 2), // Adjust for shadow position (x, y)
                                      ),
                                      BoxShadow(
                                        color: Colors.grey.withOpacity(0.3), // Adjust color and opacity
                                        spreadRadius: 2.0, // Adjust for shadow diffusion
                                        blurRadius: 4.0, // Adjust for shadow softness
                                        offset: const Offset(0, 0), // Adjust for shadow position (x, y)
                                      ),
                                    ]),
                                    child: Row(
                                      mainAxisSize: MainAxisSize.min,
                                      crossAxisAlignment: CrossAxisAlignment.start,
                                      children: [
                                        Flexible(
                                          flex: 3,
                                          child: Padding(
                                            padding: const EdgeInsets.only(top: 30.0),
                                            child: Column(
                                              crossAxisAlignment: CrossAxisAlignment.start,
                                              children: [
                                                CustomText(
                                                  TranslationKeys.makeTranslation(TranslationKeys.textAddAccount),
                                                  style: context.textTheme.titleSmall!.copyWith(fontSize: 15, fontWeight: FontWeight.w400),
                                                ),
                                                const SizedBox(height: 5),
                                                CustomText(
                                                  "40+ currencies",
                                                  style: context.textTheme.bodyMedium!.copyWith(fontSize: 11, fontWeight: FontWeight.w400),
                                                  overflow: TextOverflow.ellipsis,
                                                )
                                              ],
                                            ),
                                          ),
                                        ),
                                        const SizedBox(width: 30),
                                        Flexible(
                                          child: Column(
                                            mainAxisSize: MainAxisSize.min,
                                            mainAxisAlignment: MainAxisAlignment.start,
                                            children: [
                                              Container(
                                                // height: 50,
                                                // width: 50,
                                                padding: const EdgeInsets.all(10.0),
                                                decoration: BoxDecoration(
                                                  color: AppColors.colorGrey350,
                                                  borderRadius: BorderRadius.circular(50.0),
                                                ),
                                                child: Image.asset(AppAssets.ic_add_new_Account, height: 15, width: 15),
                                              )
                                            ],
                                          ),
                                        )
                                      ],
                                    )),
                              ),
                            ],
                          ),
                        ),
                        const SizedBox(height: 10),
                        controller.depositeAccount.isNotEmpty
                            ? Expanded(
                                child: SingleChildScrollView(
                                  child: Padding(
                                    padding: const EdgeInsets.symmetric(vertical: 5.0),
                                    child: ListView.separated(
                                      physics: const NeverScrollableScrollPhysics(),
                                      shrinkWrap: true,
                                      itemCount: controller.depositeAccount.length,
                                      itemBuilder: (context, index) {
                                        return depositAccountItem(controller, context, index);
                                      },
                                      separatorBuilder: (BuildContext context, int index) {
                                        return const Padding(padding: EdgeInsets.symmetric(vertical: 10));
                                      },
                                    ),
                                  ),
                                ),
                              )
                            : const Center(
                                child: Text("No deposit accounts found."),
                              )
                      ],
                    ),
                  ),
          ],
        );
      });
    });
  }

  GestureDetector depositAccountItem(DashboardScreenController controller, BuildContext context, int index) {
    return GestureDetector(
      onTap: () {
        Get.toNamed(Routes.ACCOUNT_STATEMENT, arguments: {"accountNumber": controller.depositeAccount.elementAt(index).mbmBkmsnumber});
      },
      child: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 0.0),
        child: Container(
          // padding: const EdgeInsets.all(5.0),
          decoration: BoxDecoration(borderRadius: BorderRadius.circular(0), color: Colors.white, boxShadow: [
            BoxShadow(
              color: Colors.grey.withOpacity(0.3),
              spreadRadius: 2.0,
              blurRadius: 4.0,
              offset: const Offset(0, 2),
            ),
            BoxShadow(
              color: Colors.grey.withOpacity(0.3),
              spreadRadius: 2.0,
              blurRadius: 4.0,
              offset: const Offset(0, 0),
            ),
          ]),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              const SizedBox(width: 7),
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 15),
                child: Align(alignment: Alignment.bottomRight, child: Image.asset(controller.getFlagWithCurrencyCode(controller.depositeAccount.elementAt(index).pcrCurrcode), width: 40, height: 40, fit: BoxFit.cover)),
              ),
              Padding(
                padding: const EdgeInsets.symmetric(horizontal: 5),
                child: Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [
                  CustomText(
                    "${controller.depositeAccount.elementAt(index).mbmBkmstitle.toString()} (${controller.depositeAccount.elementAt(index).pcrCurrshort})",
                    style: Theme.of(Get.context!).textTheme.titleSmall!.copyWith(fontSize: 14, fontWeight: FontWeight.w400),
                  ),
                  const SizedBox(height: 5),
                  CustomText(
                    controller.depositeAccount.elementAt(index).mbmBkmsnumber.toString(),
                    style: Theme.of(Get.context!).textTheme.titleSmall!.copyWith(fontSize: 10, fontWeight: FontWeight.w500),
                  ),
                ]),
              ),
              Expanded(
                flex: 3,
                child: Align(
                  alignment: Alignment.centerRight,
                  child: CustomText(
                    "${controller.depositeAccount.elementAt(index).pcrCurrshort} ${controller.depositeAccount.elementAt(index).mbmBkmsbalance.toStringAsFixed(2)}",
                    style: context.textTheme.titleMedium!.copyWith(fontSize: 13, fontWeight: FontWeight.w400),
                  ),
                ),
              ),
              Align(
                  alignment: Directionality.of(Get.context!) == TextDirection.rtl ? Alignment.bottomLeft : Alignment.bottomRight,
                  child: Padding(
                    padding: const EdgeInsets.only(top: 26),
                    child: SizedBox(
                        height: 55,
                        width: 55,
                        child: SvgPicture.asset(
                          fit: BoxFit.cover,
                          AppAssets.ic_desposit_account_arrow,
                          height: 45,
                          width: 40,
                        )),
                  )),
            ],
          ),
        ),
      ),
    );
  }
}

class AddMoneyAndKyc extends StatelessWidget {
  const AddMoneyAndKyc({super.key});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(left: 22, right: 22),
      child: Row(
        children: [
          GestureDetector(
            onTap: () {
              Get.toNamed(Routes.ADD_MONEY);
            },
            child: Container(
              padding: const EdgeInsets.all(15.0),
              child: Container(
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(25),
                  border: Border.all(color: AppColors.ff444444),
                ),
                padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
                child: Row(
                  children: [
                    CustomText(
                      "Add Money",
                      style: context.textTheme.bodyMedium!.copyWith(fontSize: 11, fontWeight: FontWeight.w400),
                    ),
                    const SizedBox(
                      width: 4,
                    ),
                    const Icon(Icons.add, color: Colors.green, size: 15)
                  ],
                ),
              ),
            ),
          ),
          const Spacer(),
          Container(
            decoration: BoxDecoration(
              color: SessionCache.instance.userInfo.isKycVerified ? Colors.green : AppColors.ffF95846,
              borderRadius: const BorderRadius.only(topLeft: Radius.circular(22), bottomRight: Radius.circular(22)),
            ),
            padding: const EdgeInsets.only(top: 5.5, bottom: 5.5, left: 12, right: 12),
            child: Row(
              children: [
                CustomText(
                  SessionCache.instance.userInfo.isKycVerified ? "KYC verified" : "KYC Unverified",
                  style: context.textTheme.bodyMedium!.copyWith(
                    fontSize: 11,
                    color: Colors.white,
                    fontWeight: FontWeight.w400,
                  ),
                ),
                const SizedBox(width: 4),
                SvgPicture.asset(
                  SessionCache.instance.userInfo.isKycVerified ? AppAssets.ic_tick_option : AppAssets.ic_cross_white,
                  width: 15,
                  height: 15,
                )
              ],
            ),
          ),
        ],
      ),
    );
  }
}
