defaultFields static method

List<Widget> defaultFields(
  1. BuildContext context, {
  2. dynamic onFirstNameChange(
    1. String value
    )?,
  3. dynamic onLastNameChange(
    1. String value
    )?,
  4. dynamic onUsernameChange(
    1. String value
    )?,
  5. dynamic onEmailChange(
    1. String value
    )?,
  6. dynamic onPasswordChange(
    1. String value
    )?,
  7. dynamic onConfirmPasswordChange(
    1. String value
    )?,
  8. List<InputFeedbackText>? passwordFeedback,
  9. List<InputFeedbackText>? confirmPasswordFeedback,
  10. List<TextInputFormatter>? firstNameInputFormatters,
  11. List<TextInputFormatter>? lastNameInputFormatters,
  12. List<TextInputFormatter>? usernameInputFormatters,
  13. List<TextInputFormatter>? emailInputFormatters,
  14. List<TextInputFormatter>? passwordInputFormatters,
  15. String? emailLabel,
  16. String? passwordLabel,
  17. String? confirmPasswordLabel,
})

Implementation

static List<Widget> defaultFields(
  BuildContext context, {
  Function(String value)? onFirstNameChange,
  Function(String value)? onLastNameChange,
  Function(String value)? onUsernameChange,
  Function(String value)? onEmailChange,
  Function(String value)? onPasswordChange,
  Function(String value)? onConfirmPasswordChange,
  List<InputFeedbackText>? passwordFeedback,
  List<InputFeedbackText>? confirmPasswordFeedback,
  List<TextInputFormatter>? firstNameInputFormatters,
  List<TextInputFormatter>? lastNameInputFormatters,
  List<TextInputFormatter>? usernameInputFormatters,
  List<TextInputFormatter>? emailInputFormatters,
  List<TextInputFormatter>? passwordInputFormatters,
  String? emailLabel,
  String? passwordLabel,
  String? confirmPasswordLabel,
}) {
  final GBUiKitLocalizations localizations = GBUiKitLocalizations.of(context);
  return [
    if (onFirstNameChange != null)
      TextField(
        label: localizations.firstName,
        hintText: localizations.enterYourFirstName,
        onChanged: onFirstNameChange,
      ),
    if (onLastNameChange != null)
      TextField(
        label: localizations.lastName,
        hintText: localizations.enterYourLastName,
        onChanged: onLastNameChange,
        inputFormatters: lastNameInputFormatters,
      ),
    if (onUsernameChange != null)
      TextField(
        label: localizations.username,
        hintText: localizations.enterYourUsername,
        onChanged: onUsernameChange,
        inputFormatters: usernameInputFormatters,
      ),
    if (onEmailChange != null)
      TextField(
        label: emailLabel ?? localizations.email,
        hintText: localizations.enterYourEmail,
        keyboardType: TextInputType.emailAddress,
        onChanged: onEmailChange,
        inputFormatters: emailInputFormatters,
      ),
    if (onPasswordChange != null)
      PasswordField(
        label: passwordLabel ?? localizations.password,
        hintText: localizations.enterYourPassword,
        onChanged: onPasswordChange,
        inputFormatters: passwordInputFormatters,
        feedback: [
          if (passwordFeedback != null) ...passwordFeedback
          // InputFeedbackText.check(
          //   key: ValueKey("chars count"),
          //   active: state.passwordCharCountPass,
          //   text: Text(
          //     localizations.xCharacters(6),
          //   ),
          //   color: GBTheme.backgroundContrast(context),
          // ),
          // InputFeedbackText.check(
          //   key: ValueKey("chars symbols"),
          //   active: state.passwordSymbolsPass,
          //   text: Text(
          //     localizations.mixOfLettersNumbersAndSymbols,
          //   ),
          //   color: GBTheme.backgroundContrast(context),
          // ),
        ],
      ),
    if (onConfirmPasswordChange != null)
      PasswordField(
        label: confirmPasswordLabel ?? localizations.confirmPassword,
        hintText: localizations.confirmYourPassword,
        onChanged: onConfirmPasswordChange,
        inputFormatters: passwordInputFormatters,
        feedback: [if (confirmPasswordFeedback != null) ...confirmPasswordFeedback],
      ),
  ];
}