import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:grostore/app_lang.dart';
import 'package:grostore/configs/style_config.dart';
import 'package:grostore/configs/theme_config.dart';
import 'package:grostore/custom_ui/Button.dart';
import 'package:grostore/custom_ui/auth_ui.dart';
import 'package:grostore/custom_ui/input_decorations.dart';
import 'package:grostore/helpers/device_info_helper.dart';
import 'package:grostore/helpers/route.dart';
import 'package:grostore/presenters/auth/auth_presenter.dart';
import 'package:grostore/screens/auth/password_otp.dart';
import 'package:provider/provider.dart';

import '../../custom_ui/Boxdecorations.dart';


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

  @override
  _PasswordForgetState createState() => _PasswordForgetState();
}

class _PasswordForgetState extends State<PasswordForget> {
  @override
  Widget build(BuildContext context) {
    return AuthScreen.buildScreen(context, buildBody(getWidth(context), context));
  }

  Widget buildBody(double screenWidth, BuildContext context) {
    return Consumer<AuthPresenter>(builder: (context, data, child) {
      return Container(
        alignment: Alignment.center,
        padding: EdgeInsets.symmetric(horizontal: StyleConfig.padding),

        width: screenWidth * (3 / 4),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              width: getWidth(context),
              padding: const EdgeInsets.only(bottom: 4.0),
              child: Text(
                AppLang.local(context).forgot_password_ucf,
                style: StyleConfig.fs24fwBold,
                textAlign: TextAlign.center,
              ),
            ),
            Padding(
              padding: const EdgeInsets.only(bottom: 4.0),
              child: Text(
                AppLang.local(context).please_enter_phone,
                style: TextStyle(
                    color: ThemeConfig.fontColor, fontWeight: FontWeight.w600),
              ),
            ),
            Padding(
              padding: const EdgeInsets.only(bottom: 8.0),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.end,
                children: [
                  SizedBox(
                    height: 45,
                    child: Padding(
                      padding: const EdgeInsets.only(bottom: 8.0),
                      child: Container(
                          decoration: BoxDecorations.basic(),
                          height: 36,
                          child: Row(
                            children: [
                              Padding(
                                padding: const EdgeInsets.symmetric(horizontal: 14.0),
                                child: Icon(
                                  Icons.phone,
                                  size: 18,
                                  color: ThemeConfig.mediumGrey,
                                ),
                              ),
                              Text(
                                "+998",
                                style: StyleConfig.fs14fwNormal,
                              ),
                              // Button(
                              //   minWidth: 80,
                              //   onPressed: () {
                              //     showDialog(
                              //         context: context,
                              //         builder: (context) {
                              //           return buildFilterDialog(data);
                              //         });
                              //   },
                              //   child: Row(
                              //     children: [
                              //       Image.asset(
                              //           "${getAssetFlag(data.regCountry.code.toLowerCase())}.png"),
                              //
                              //     ],
                              //   ),
                              // ),
                              Container(
                                padding: const EdgeInsets.only(left: 10),
                                width: getWidth(context) - 200,
                                child: TextField(
                                  style: StyleConfig.fs14fwNormal,
                                  decoration: const InputDecoration.collapsed(
                                      hintText: "XX XXX XXX"),
                                  controller: data.forgetPhoneNumberController,
                                ),
                              )
                            ],
                          )),
                    ),
                  ),
                ],
              ),
            ),

            Padding(
              padding: const EdgeInsets.only(top: 30.0),
              child: SizedBox(
                height: 45,
                child: Button.minSize(
                    width: getWidth(context),
                    height: 50,
                    color: ThemeConfig.red,
                    shape: const RoundedRectangleBorder(
                        borderRadius: BorderRadius.all(Radius.circular(6.0))),
                    child: Text(
                      AppLang.local(context).send,
                      style:const TextStyle(
                          color: Colors.white,
                          fontSize: 14,
                          fontWeight: FontWeight.w600),
                    ),
                    onPressed: () {
                      data.onPressSendCode();
                      // MakeRoute.go(context, PasswordOtp(phone_num:data.loginPhoneNumberController.text,));

                    }),
              ),
            ),
          ],
        ),
      );
    });
  }
}
