import '/flutter_flow/flutter_flow_util.dart';
import 'sign_up_template_component_widget.dart'
    show SignUpTemplateComponentWidget;
import 'package:flutter/material.dart';

class SignUpTemplateComponentModel
    extends FlutterFlowModel<SignUpTemplateComponentWidget> {
  ///  State fields for stateful widgets in this component.

  final formKey = GlobalKey<FormState>();
  // State field(s) for nameRegisterForm widget.
  FocusNode? nameRegisterFormFocusNode;
  TextEditingController? nameRegisterFormTextController;
  String? Function(BuildContext, String?)?
      nameRegisterFormTextControllerValidator;
  String? _nameRegisterFormTextControllerValidator(
      BuildContext context, String? val) {
    if (val == null || val.isEmpty) {
      return FFLocalizations.of(context).getText(
        '3bs10dfq' /* Campo é necessário */,
      );
    }

    if (!RegExp(kTextValidatorUsernameRegex).hasMatch(val)) {
      return 'Must start with a letter and can only contain letters, digits and - or _.';
    }
    return null;
  }

  // State field(s) for emailRegisterForm widget.
  FocusNode? emailRegisterFormFocusNode;
  TextEditingController? emailRegisterFormTextController;
  String? Function(BuildContext, String?)?
      emailRegisterFormTextControllerValidator;
  String? _emailRegisterFormTextControllerValidator(
      BuildContext context, String? val) {
    if (val == null || val.isEmpty) {
      return FFLocalizations.of(context).getText(
        'mlvw63yj' /* Campo é necessário */,
      );
    }

    if (!RegExp(kTextValidatorEmailRegex).hasMatch(val)) {
      return 'Has to be a valid email address.';
    }
    return null;
  }

  // State field(s) for passwordRegisterForm widget.
  FocusNode? passwordRegisterFormFocusNode;
  TextEditingController? passwordRegisterFormTextController;
  late bool passwordRegisterFormVisibility;
  String? Function(BuildContext, String?)?
      passwordRegisterFormTextControllerValidator;
  String? _passwordRegisterFormTextControllerValidator(
      BuildContext context, String? val) {
    if (val == null || val.isEmpty) {
      return FFLocalizations.of(context).getText(
        '6nn79lmh' /* Campo é necessário */,
      );
    }

    return null;
  }

  // Stores action output result for [Action Block - signUpRegisterAction] action in SignUpButtonRegisterForm widget.
  bool? signUp;

  @override
  void initState(BuildContext context) {
    nameRegisterFormTextControllerValidator =
        _nameRegisterFormTextControllerValidator;
    emailRegisterFormTextControllerValidator =
        _emailRegisterFormTextControllerValidator;
    passwordRegisterFormVisibility = false;
    passwordRegisterFormTextControllerValidator =
        _passwordRegisterFormTextControllerValidator;
  }

  @override
  void dispose() {
    nameRegisterFormFocusNode?.dispose();
    nameRegisterFormTextController?.dispose();

    emailRegisterFormFocusNode?.dispose();
    emailRegisterFormTextController?.dispose();

    passwordRegisterFormFocusNode?.dispose();
    passwordRegisterFormTextController?.dispose();
  }
}
