initializeProperties method

void initializeProperties()

Initializes properties based on the form type

Implementation

void initializeProperties() {
  switch (widget.formType) {
    case FormType.email:
      fieldName = 'Email';
      hintText = 'Enter your email';
      iconData = widget.outlinedIcon ? Icons.email_outlined : Icons.email;
      invalidFormErrorMessage = "Please enter a valid email";
      emptyFieldErrorMessage = "Please enter your email";
      inputType = TextInputType.emailAddress;
      enableSuggestions = true;
      maxLines = 1;
      minLines = 1;
      textInputAction = TextInputAction.done;
      break;

    case FormType.aboutMe:
      fieldName = 'About Me';
      hintText = 'Tell us about yourself';
      iconData =
          widget.outlinedIcon ? Icons.person_pin_outlined : Icons.person_pin;
      invalidFormErrorMessage = "Invalid input";
      emptyFieldErrorMessage = "Please enter some information about yourself";
      inputType = TextInputType.multiline;
      enableSuggestions = true;
      maxLines = 3;
      minLines = 1;
      textInputAction = TextInputAction.newline;
      break;

    case FormType.password:
      fieldName = 'Password';
      hintText = 'Enter your password';
      iconData = widget.outlinedIcon ? Icons.lock_outlined : Icons.lock;
      invalidFormErrorMessage = "Password must be at least 6 characters";
      emptyFieldErrorMessage = "Please enter your password";
      inputType = TextInputType.visiblePassword;
      enableSuggestions = false;
      maxLines = 1;
      minLines = 1;
      textInputAction = TextInputAction.done;
      break;

    case FormType.userName:
      fieldName = 'Username';
      hintText = 'Enter your username';
      iconData = widget.outlinedIcon ? Icons.person_outline : Icons.person;
      invalidFormErrorMessage = "Invalid username";
      emptyFieldErrorMessage = "Please enter your username";
      inputType = TextInputType.text;
      enableSuggestions = true;
      maxLines = 1;
      minLines = 1;
      textInputAction = TextInputAction.done;
      break;
  }
}