getInputType function

TextInputType getInputType(
  1. List<LoginType> supportedAuthMechanisms
)

Implementation

TextInputType getInputType(List<LoginType> supportedAuthMechanisms) {
  // contains only email
  if (supportedAuthMechanisms.contains(LoginType.EMAIL_PASSWORD) &&
      !supportedAuthMechanisms.contains(LoginType.PHONE_PASSWORD) &&
      !supportedAuthMechanisms.contains(LoginType.USERNAME_PASSWORD))
    return TextInputType.emailAddress;
  // contains only phone
  if (supportedAuthMechanisms.contains(LoginType.PHONE_PASSWORD) &&
      !supportedAuthMechanisms.contains(LoginType.EMAIL_PASSWORD) &&
      !supportedAuthMechanisms.contains(LoginType.USERNAME_PASSWORD))
    return TextInputType.phone;
  // all others are intertwined; use text
  return TextInputType.text;
}