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

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

  @override
  State<WithdrawalConfirmation> createState() => _WithdrawalConfirmationState();
}

class _WithdrawalConfirmationState extends State<WithdrawalConfirmation> {
  final List titles = [
    AppText.paymentMethod,
    AppText.accountName,
    AppText.iban,
    AppText.beneficiaryAddress,
    AppText.bankName,
    AppText.branchAddress,
    AppText.SWIFTcode,
    AppText.refid,
  ];
  final List values = [
    'Google/Apple Pay',
    'Name Surname',
    'DE 1234 5678 9012 3456',
    'Hohenzollernring 58, 95444',
    'Name Bank',
    'Hohenzollernring 58, 95444',
    'BC12345',
    'FRYU FHDU 1234',
  ];

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () async => false,
      child: Scaffold(
        backgroundColor: Colors.white,
        appBar: AppBar(
          automaticallyImplyLeading: false,
          backgroundColor: Colors.white,
          elevation: 0,
          scrolledUnderElevation: 0.0,
          centerTitle: true,
          title: Text(
            AppText.previewTitle,
            style: GoogleFonts.dmSans(
              color: const Color(0xFF272727),
              fontSize: 20.sp,
              fontWeight: FontWeight.w700,
            ),
          ),
          actions: [
            IconButton(
              onPressed: () {
                goRouter.pop();
                goRouter.pop();
                goRouter.pop();
                goRouter.pop();
              },
              icon: const Icon(
                Icons.close_sharp,
              ),
            ),
          ],
        ),
        body: SingleChildScrollView(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Padding(
                padding: const EdgeInsets.fromLTRB(18.0, 10, 18.0, 0),
                child: Row(
                  mainAxisSize: MainAxisSize.min,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Image.asset(
                      'assets/images/wallet_screen/done.png',
                      height: 25.h,
                    ),
                    SizedBox(
                      width: 10.w,
                    ),
                    Expanded(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            AppText.info,
                            style: GoogleFonts.dmSans(
                              color: const Color(0xFF015698),
                              fontSize: 14.sp,
                              fontWeight: FontWeight.w700,
                            ),
                          ),
                          SizedBox(
                            height: 4.h,
                          ),
                          Text(
                            AppText.workingDays,
                            style: GoogleFonts.dmSans(
                              color: const Color(0xFF015698),
                              fontSize: 12.sp,
                              fontWeight: FontWeight.w500,
                            ),
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
              SizedBox(
                height: 20.h,
              ),
              Padding(
                padding: const EdgeInsets.symmetric(horizontal: 18.0),
                child: Container(
                  width: double.infinity,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(22.r),
                    color: Colors.transparent,
                    boxShadow: [
                      BoxShadow(
                        color: Colors.black.withOpacity(0.15),
                        spreadRadius: 2,
                        blurRadius: 10,
                        offset: const Offset(0, 8),
                      ),
                    ],
                  ),
                  child: TicketWidget(
                    isCornerRounded: true,
                    height: MediaQuery.of(context).size.height - 75,
                    width: double.infinity,
                    child: Padding(
                      padding: const EdgeInsets.fromLTRB(30.0, 30, 30, 10),
                      child: Column(
                        mainAxisSize: MainAxisSize.min,
                        children: [
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              Container(
                                decoration: const BoxDecoration(
                                  shape: BoxShape.circle,
                                  color: Color(0xFFE6681F),
                                ),
                                child: Padding(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Image.asset(
                                    'assets/images/wallet_screen/withdraw_list.png',
                                    height: 25.h,
                                  ),
                                ),
                              ),
                              SizedBox(
                                height: 16.h,
                              ),
                              Text(
                                AppText.withdrawal,
                                style: GoogleFonts.dmSans(
                                  color: const Color(0xFF191B1E),
                                  fontSize: 14.sp,
                                  fontWeight: FontWeight.w600,
                                ),
                              ),
                              SizedBox(
                                height: 4.h,
                              ),
                              Text(
                                '10/04/2024 22:04',
                                style: GoogleFonts.dmSans(
                                  color: const Color(0xFF8D8D8D),
                                  fontSize: 11.sp,
                                  fontWeight: FontWeight.w500,
                                ),
                              ),
                              SizedBox(
                                height: 16.h,
                              ),
                              Text(
                                '- SAR 1000',
                                style: GoogleFonts.dmSans(
                                  color: const Color(0xFF191B1E),
                                  fontSize: 20.sp,
                                  fontWeight: FontWeight.w400,
                                ),
                              ),
                            ],
                          ),
                          SizedBox(
                            height: 30.h,
                          ),
                          ListView.builder(
                            physics: const NeverScrollableScrollPhysics(),
                            shrinkWrap: true,
                            itemCount: titles.length,
                            itemBuilder: (context, index) {
                              return Column(
                                children: [
                                  Padding(
                                    padding: const EdgeInsets.symmetric(
                                        vertical: 12.0),
                                    child: Row(
                                      mainAxisAlignment:
                                          MainAxisAlignment.spaceBetween,
                                      children: [
                                        Text(
                                          titles[index],
                                          style: GoogleFonts.dmSans(
                                            color: const Color(0xFF535353),
                                            fontSize: 14.sp,
                                            fontWeight: FontWeight.w500,
                                          ),
                                        ),
                                        SizedBox(
                                          width: 12.w,
                                        ),
                                        Expanded(
                                          child: Text(
                                            values[index],
                                            textAlign: TextAlign.end,
                                            style: GoogleFonts.dmSans(
                                              color: const Color(0xFF191B1E),
                                              fontSize: 14.sp,
                                              fontWeight: FontWeight.w600,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ),
                                  (index != titles.length - 1)
                                      ? const Divider()
                                      : Container()
                                ],
                              );
                            },
                          ),
                        ],
                      ),
                    ),
                  ),
                ),
              ),
              SizedBox(
                height: 10.h,
              ),
            ],
          ),
        ),
        bottomNavigationBar: GestureDetector(
          onTap: () {
            goRouter.pop();
            goRouter.pop();
            goRouter.pop();
            goRouter.pop();
          },
          child: Container(
            margin: const EdgeInsets.all(10.0),
            height: 65.h,
            width: double.infinity,
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(22.r),
              color: const Color(0xFF004717),
            ),
            child: Padding(
              padding: const EdgeInsets.symmetric(vertical: 20.0),
              child: Center(
                child: Text(
                  'Close',
                  style: GoogleFonts.dmSans(
                    color: Colors.white,
                    fontSize: 14.sp,
                    fontWeight: FontWeight.w700,
                  ),
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
