import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:gap/gap.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:tanami_app/core/routes/route_name.dart';
import 'package:tanami_app/core/routes/routes.dart';
import 'package:tanami_app/core/styles/app_text.dart';

import '../../../../../core/utils/language/localizations_delegate.dart';
import 'wallet_layout.dart';

class WalletScreen extends StatefulWidget {
  const WalletScreen({super.key});

  @override
  State<WalletScreen> createState() => _WalletScreenState();
}

class _WalletScreenState extends State<WalletScreen> {
  @override
  void initState() {
    // _savebottomsheet();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    var localizations = AppLocalizations.of(context);
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        elevation: 0,
        scrolledUnderElevation: 0.0,
        automaticallyImplyLeading: false,
        toolbarHeight: 260.h,
        titleSpacing: 22.w,
        title: Padding(
          padding: const EdgeInsets.only(left: 40.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                localizations.translate(AppText.walletTitle),
                style: GoogleFonts.dmSans(
                  color: const Color(0xFF343434),
                  fontSize: 14.sp,
                  fontWeight: FontWeight.w700,
                ),
              ),
              Gap(8.h),
              Text(
                'SAR 178,000',
                style: GoogleFonts.dmSans(
                  color: const Color(0xFF191B1E),
                  fontSize: 28.sp,
                  fontWeight: FontWeight.w700,
                ),
              ),
              Gap(80.h)
            ],
          ),
        ),
        flexibleSpace: FlexibleSpaceBar(
          background: Stack(
            children: [
              Image.asset(
                'assets/images/wallet_screen/bg.png', // Replace with your image asset
                fit: BoxFit.fitWidth,
                alignment: Alignment.topCenter,
              ),
              Align(
                alignment: Alignment.bottomCenter,
                child: Padding(
                  padding: const EdgeInsets.symmetric(horizontal: 20.0),
                  child: Container(
                    decoration: BoxDecoration(
                      color: Colors.white.withOpacity(0.8),
                      borderRadius:
                          const BorderRadius.all(Radius.circular(20.0)),
                    ),
                    child: Padding(
                      padding: const EdgeInsets.symmetric(
                          horizontal: 20.0, vertical: 20.0),
                      child: IntrinsicHeight(
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            GestureDetector(
                              onTap: () {
                                goRouter.pushNamed(
                                    RouteName.selectDepositMethodScreen);
                              },
                              child: Column(
                                mainAxisSize: MainAxisSize.min,
                                children: [
                                  Container(
                                    decoration: const BoxDecoration(
                                      shape: BoxShape.circle,
                                      color: Colors.black,
                                    ),
                                    child: Padding(
                                      padding: const EdgeInsets.all(8.0),
                                      child: Image.asset(
                                        'assets/images/wallet_screen/deposit.png',
                                        height: 20.h,
                                      ),
                                    ),
                                  ),
                                  Text(
                                    localizations.translate(AppText.deposit),
                                    style: GoogleFonts.dmSans(
                                      color: const Color(0xFF363636),
                                      fontSize: 12.sp,
                                      fontWeight: FontWeight.w700,
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            const VerticalDivider(
                              color: Colors.black,
                              width: 20.0,
                            ),
                            GestureDetector(
                              onTap: () {
                                goRouter.pushNamed(RouteName.withdrawalScreen);
                              },
                              child: Column(
                                mainAxisSize: MainAxisSize.min,
                                children: [
                                  Container(
                                    decoration: const BoxDecoration(
                                      shape: BoxShape.circle,
                                      color: Colors.black,
                                    ),
                                    child: Padding(
                                      padding: const EdgeInsets.all(8.0),
                                      child: Image.asset(
                                        'assets/images/wallet_screen/withdraw.png',
                                        height: 20.h,
                                      ),
                                    ),
                                  ),
                                  Text(
                                    localizations.translate(AppText.withdraw),
                                    style: GoogleFonts.dmSans(
                                      color: const Color(0xFF363636),
                                      fontSize: 12.sp,
                                      fontWeight: FontWeight.w700,
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ],
                        ),
                      ),
                    ),
                  ),
                ),
              )
            ],
          ),
        ),
        backgroundColor: Colors
            .transparent, // Make the AppBar transparent to show the background image
      ),
      body: const WalletLayout(),
    );
  }
}
