import '/backend/api_requests/api_calls.dart';
import '/components/alert_box_custom_o_k_widget.dart';
import '/flutterlib/flutter_theme.dart';
import '/flutterlib/flutter_util.dart';
import '/flutterlib/flutter_widgets.dart';
import 'login5_widget.dart' show Login5Widget;
import 'package:aligned_dialog/aligned_dialog.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';

class Login5Model extends FlutterModel<Login5Widget> {
  ///  State fields for stateful widgets in this page.

  final unfocusNode = FocusNode();
  final formKey = GlobalKey<FormState>();
  // State field(s) for password widget.
  FocusNode? passwordFocusNode;
  TextEditingController? passwordController;
  late bool passwordVisibility;
  String? Function(BuildContext, String?)? passwordControllerValidator;
  String? _passwordControllerValidator(BuildContext context, String? val) {
    if (val == null || val.isEmpty) {
      return FFLocalizations.of(context).getText(
        'pi2nkx44' /* Field is required */,
      );
    }

    if (val.length < 6) {
      return 'Requires at least 6 characters.';
    }

    return null;
  }

  // State field(s) for confirmation_password widget.
  FocusNode? confirmationPasswordFocusNode;
  TextEditingController? confirmationPasswordController;
  late bool confirmationPasswordVisibility;
  String? Function(BuildContext, String?)?
      confirmationPasswordControllerValidator;
  String? _confirmationPasswordControllerValidator(
      BuildContext context, String? val) {
    if (val == null || val.isEmpty) {
      return FFLocalizations.of(context).getText(
        'gsx5zddw' /* Field is required */,
      );
    }

    if (val.length < 6) {
      return 'Requires at least 6 characters.';
    }

    return null;
  }

  // Stores action output result for [Backend Call - API (resetPassword)] action in Button widget.
  ApiCallResponse? resetPassword;

  /// Initialization and disposal methods.

  void initState(BuildContext context) {
    passwordVisibility = false;
    passwordControllerValidator = _passwordControllerValidator;
    confirmationPasswordVisibility = false;
    confirmationPasswordControllerValidator =
        _confirmationPasswordControllerValidator;
  }

  void dispose() {
    unfocusNode.dispose();
    passwordFocusNode?.dispose();
    passwordController?.dispose();

    confirmationPasswordFocusNode?.dispose();
    confirmationPasswordController?.dispose();
  }

  /// Action blocks are added here.

  /// Additional helper methods are added here.
}
