import 'package:flutter/material.dart';

import '/flutter_flow/flutter_flow_util.dart';
import 'sign_up_template_component_widget.dart'
    show SignUpTemplateComponentWidget;

class SignUpTemplateComponentModel
    extends FlutterFlowModel<SignUpTemplateComponentWidget> {
  final formKey = GlobalKey<FormState>();
  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 */,
      );
    }

    return null;
  }

  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 FFLocalizations.of(context).getText(
        'vobnktrz' /* Insira um email valido. */,
      );
    }
    return null;
  }

  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 */,
      );
    }

    if (val.length < 8) {
      return FFLocalizations.of(context).getText(
        'duq5gpp6' /* A senha deve ter pelo menos 8 ... */,
      );
    }

    return null;
  }

  bool? register;

  @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();
  }
}
