import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/view_models/user_view_model.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/button/show_image_button.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class ForgetPasswordMethodPage extends StatefulWidget {
  final String userToken;

  const ForgetPasswordMethodPage(this.userToken, {Key? key}) : super(key: key);

  @override
  State<ForgetPasswordMethodPage> createState() => _ForgetPasswordMethodPageState();
}

class _ForgetPasswordMethodPageState extends State<ForgetPasswordMethodPage> {
  int otpType = 1;
  String userOTP = "";

  @override
  Widget build(BuildContext context) {
    UserVM userVM = context.read<UserVM>();
    return Scaffold(
      appBar: CustomAppBar( isRemoveBackButton: true,title: LocaleKeys.forgetPassword.tr(),),
      body: Container(
        width: double.infinity,
        height: double.infinity,
        padding: const EdgeInsets.all(40),
        child: Column(
          children: [
            LocaleKeys.selectMethod.tr().toText(height: 23 / 24, fontSize: 24, letterSpacing: -1.44,),
            12.height,
            Row(
              children: [
                Expanded(
                  child: ShowImageButton(
                    onClick: () async {
                      otpType = 1;
                      await userVM.forgetPasswordOTPMethod(context, userToken: widget.userToken);
                    },
                    title: LocaleKeys.SMS.tr(),
                    icon: MyAssets.icSmsSvg,
                  ),
                ),
                20.width,
                Expanded(
                  child: ShowImageButton(
                    onClick: () async {
                      otpType = 1;
                      await userVM.forgetPasswordOTPMethod(context, userToken: widget.userToken);
                    },
                    title: LocaleKeys.whatsapp.tr(),
                    icon: MyAssets.icWhatsAppSvg,
                  ),
                ),
              ],
            ),
            Utils.mFlex(10),
          ],
        ),
      ),
    );
  }
}
