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/form_field_constants.dart';
import '../../../core/constants/translation_keys.dart';
import '../../../custom_widgets/Fields/input_field.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/dail_transaction_limit_controller.dart';

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

  @override
  Widget build(BuildContext context) {
    String className = runtimeType.toString().split('.').last;
    return Scaffold(
      appBar: DashBoardAppBar(
        title: TranslationKeys.makeTranslation(TranslationKeys.textTransactionLimit),
        onBackButtonPressed: () {
          Get.back();
        },
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.only(right: 20.0, left: 20.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 20.0),
                child: Container(
                  decoration: BoxDecoration(
                    border: Border.all(color: AppColors.colorGrey350),
                    borderRadius: const BorderRadius.all(Radius.circular(8.0)),
                  ),
                  child: Column(
                    children: [
                      Padding(
                        padding: const EdgeInsets.only(top: 8.0),
                        child: CircleAvatar(
                          backgroundColor: AppColors.colorGrey200,
                          minRadius: 30,
                          child: SvgPicture.asset(AppAssets.ic_money_management, height: 30, width: 30),
                        ),
                      ),
                      const SizedBox(height: 10),
                      Text(TranslationKeys.makeTranslation(TranslationKeys.textOldLimit), style: Theme.of(context).textTheme.titleMedium),
                      const SizedBox(height: 10),
                      Text(TranslationKeys.makeTranslation(TranslationKeys.textCurrentDailyLimit), style: Theme.of(context).textTheme.titleSmall?.copyWith(fontSize: 14, fontWeight: FontWeight.w400)),
                      const SizedBox(height: 10),
                    ],
                  ),
                ),
              ),
              const SizedBox(height: 5),
              controller.newDailyLimit = InputField(
                refKey: FormFieldConstants.instance().getFormKey("${className}SetDailyLimitAmount"),
                controller: FormFieldConstants.instance().getController("${className}SetDailyLimitAmount"),
                // hintText: "Enter username",
                labelText: "Set Daily Limit Amount",
                keyboardType: TextInputType.text,
              ),
              controller.debitCardNumber = InputField(
                refKey: FormFieldConstants.instance().getFormKey("${className}DebitCardNumber"),
                controller: FormFieldConstants.instance().getController("${className}DebitCardNumber"),
                labelText: "Debit Card Number",
                keyboardType: TextInputType.text,
              ),
              controller.atmPin = InputField(
                refKey: FormFieldConstants.instance().getFormKey("${className}ATMPin"),
                controller: FormFieldConstants.instance().getController("${className}ATMPin"),
                labelText: "ATMPin",
                keyboardType: TextInputType.text,
              ),
              const SizedBox(height: 20),
              Text(TranslationKeys.makeTranslation(TranslationKeys.textMaximumLengthContent), style: Theme.of(context).textTheme.bodySmall?.copyWith(fontSize: 12, fontWeight: FontWeight.w400)),
              const SizedBox(height: 10),
              Text(TranslationKeys.makeTranslation(TranslationKeys.textLimitNoteContent), style: Theme.of(context).textTheme.bodySmall?.copyWith(fontSize: 12, fontWeight: FontWeight.w400)),
            ],
          ),
        ),
      ),
      persistentFooterButtons: [
        Padding(
          padding: const EdgeInsets.symmetric(horizontal: 20),
          child: CustomButton(
            onPressed: () {
              Get.offAndToNamed(Routes.APP_SETTING);
            },
            buttonText: TranslationKeys.makeTranslation(TranslationKeys.textDone),
            buttonColor: AppColors.colorButton,
            buttonPadding: const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
          ),
        ),
        // Padding(
        //   padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
        //   child: SizedBox(
        //     width: double.infinity,
        //     child: ElevatedButton(
        //       onPressed: () {
        //         Get.offAndToNamed(Routes.APP_SETTING);
        //       },
        //       style: ElevatedButton.styleFrom(
        //         backgroundColor: AppColors.colorButton,
        //         shape: RoundedRectangleBorder(
        //           borderRadius: BorderRadius.circular(50),
        //         ),
        //       ),
        //       child: Padding(
        //         padding: const EdgeInsets.all(12.0),
        //         child: Text(TranslationKeys.makeTranslation(TranslationKeys.textDone), style: Theme.of(context).textTheme.labelMedium?.copyWith(color: AppColors.white)),
        //       ),
        //     ),
        //   ),
        // ),
      ],
      persistentFooterAlignment: AlignmentDirectional.bottomCenter,
      resizeToAvoidBottomInset: false,
      backgroundColor: AppColors.colorSecondary,
    );
  }
}
