// ignore_for_file: avoid_unnecessary_containers

import 'package:flutter/material.dart';
import 'package:tour_travel_agr/helper/components_widget/custom_appbar.dart';
import 'package:tour_travel_agr/helper/components_widget/widget_button.dart';
import 'package:tour_travel_agr/helper/components_widget/widget_text_field.dart';
import 'package:tour_travel_agr/resource/assets.dart';
import 'package:tour_travel_agr/resource/colors.dart';
import 'package:tour_travel_agr/resource/size.dart';
import 'package:tour_travel_agr/resource/style.dart';

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

  @override
  State<ForgotPasswordView> createState() => _ForgotPasswordViewState();
}

class _ForgotPasswordViewState extends State<ForgotPasswordView> {
  final TextEditingController whatsappController = TextEditingController();

  bool buttonActive = false;

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ColorManager.backgroundColor,
      body: Stack(
        children: [
          Positioned(
            top: 0,
            left: 0,
            child: Image(
              height: 100,
              image: AssetImage(
                Assets.elipse,
              ),
            ),
          ),
          Container(
            padding: EdgeInsets.only(
              top: AppPadding.safeAreaTop(context),
              left: AppPadding.p20,
              right: AppPadding.p20,
              bottom: AppPadding.safeAreaBot(context),
            ),
            child: Column(
              children: [
                const CustomAppBar(
                  text: "ForgotPassword",
                ),
                Expanded(
                  child: SingleChildScrollView(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Container(
                          child: Center(
                            child: Image(
                              width: 216,
                              height: 216,
                              image: AssetImage(
                                Assets.forgotPassword,
                              ),
                            ),
                          ),
                        ),
                        Container(
                          margin: EdgeInsets.only(
                            top: AppMargin.m25,
                          ),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                "Forgot",
                                style: getSemiBoldStyle(
                                  color: Colors.black,
                                  fontSize: 32,
                                ),
                              ),
                              Text(
                                "Password",
                                style: getSemiBoldStyle(
                                  color: Colors.black,
                                  fontSize: 32,
                                ),
                              )
                            ],
                          ),
                        ),
                        Container(
                          margin: EdgeInsets.only(
                            top: AppMargin.m12,
                          ),
                          child: Text(
                            "Dont worry! It happens. Please enter your number phone",
                            style: getMediumStyle(
                              color: ColorManager.grey,
                            ),
                          ),
                        ),
                        SizedBox(
                          height: AppMargin.m20,
                        ),
                        InputTextField(
                          controller: whatsappController,
                          labelText: "No Whatsapp",
                          inputType: TextInputType.number,
                          onChanged: (val) {
                            if (val.length > 7) {
                              setState(() {
                                buttonActive = true;
                              });
                            } else {
                              setState(() {
                                buttonActive = false;
                              });
                            }
                          },
                        ),
                        SizedBox(
                          height: AppMargin.m20,
                        ),
                        CustomButton(
                          text: "Submit",
                          colorButton: (!buttonActive) ? Colors.grey : null,
                          onTap: () {
                            // TODO: dosomething here
                          },
                        )
                      ],
                    ),
                  ),
                )
              ],
            ),
          ),
        ],
      ),
    );
  }
}
