getDefaultSteps static method

List<AuthStep> getDefaultSteps({
  1. TextEditingController? emailController,
  2. TextEditingController? passController,
  3. bool passHidden = true,
  4. dynamic passHideOnChange(
    1. bool mainPass,
    2. bool value
    )?,
  5. RegistrationTranslations translations = const RegistrationTranslations.empty(),
  6. dynamic titleBuilder(
    1. String title
    )?,
  7. dynamic labelBuilder(
    1. String label
    )?,
  8. TextStyle? textStyle,
  9. String? initialEmail,
})

Generates default registration steps.

emailController controller for email input.

pass1Controller controller for first password input.

pass1Hidden whether the first password field is initially hidden.

pass2Controller controller for second password input.

pass2Hidden whether the second password field is initially hidden.

passHideOnChange function triggered when password visibility changes.

translations translations for default registration messages and prompts.

titleBuilder function for customizing step titles.

labelBuilder function for customizing field labels.

textStyle text style for input fields.

initialEmail initial value for email input.

Implementation

static List<AuthStep> getDefaultSteps({
  TextEditingController? emailController,
  TextEditingController? passController,
  bool passHidden = true,
  Function(bool mainPass, bool value)? passHideOnChange,
  RegistrationTranslations translations =
      const RegistrationTranslations.empty(),
  Function(String title)? titleBuilder,
  Function(String label)? labelBuilder,
  TextStyle? textStyle,
  String? initialEmail,
}) {
  return [
    AuthStep(
      fields: [
        AuthTextField(
          name: 'email',
          textEditingController: emailController,
          value: initialEmail ?? '',
          title: titleBuilder?.call(translations.defaultEmailTitle) ??
              const Padding(
                padding: EdgeInsets.only(top: 180),
                child: Text(
                  'Enter your e-mail',
                  style: TextStyle(
                    color: Color(0xff71C6D1),
                    fontWeight: FontWeight.w800,
                    fontSize: 24,
                  ),
                ),
              ),
          textFieldDecoration: InputDecoration(
            contentPadding: const EdgeInsets.symmetric(horizontal: 8),
            label: labelBuilder?.call(translations.defaultEmailLabel),
            hintText: translations.defaultEmailHint,
            border: const OutlineInputBorder(),
          ),
          textStyle: textStyle,
          padding: const EdgeInsets.symmetric(vertical: 20),
          validators: [
            (email) => (email == null || email.isEmpty)
                ? translations.defaultEmailEmpty
                : null,
            (email) =>
                RegExp(r"""(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])""")
                        .hasMatch(email!)
                    ? null
                    : translations.defaultEmailValidatorMessage,
          ],
        ),
      ],
    ),
    AuthStep(
      fields: [
        AuthPassField(
          name: 'password',
          textEditingController: passController,
          title: titleBuilder?.call(translations.defaultPasswordTitle) ??
              Padding(
                padding: const EdgeInsets.only(top: 180),
                child: Text(
                  translations.defaultPasswordTitle,
                  style: const TextStyle(
                    color: Color(0xff71C6D1),
                    fontWeight: FontWeight.w800,
                    fontSize: 24,
                  ),
                ),
              ),
          textFieldDecoration: InputDecoration(
            contentPadding: const EdgeInsets.symmetric(horizontal: 8),
            label: labelBuilder?.call(translations.defaultPasswordLabel),
            hintText: translations.defaultPasswordHint,
            border: const OutlineInputBorder(),
          ),
          padding: const EdgeInsets.symmetric(vertical: 20),
          textStyle: textStyle,
          validators: [
            (value) => (value == null || value.isEmpty)
                ? translations.defaultPasswordValidatorMessage
                : null,
          ],
        ),
      ],
    ),
  ];
}