feat: add option for textalignment of inputfields

This commit is contained in:
Freek van de Ven 2024-03-07 13:46:13 +01:00
parent 9e283f8be4
commit 3cb1e0566b
4 changed files with 14 additions and 0 deletions

View file

@ -1,6 +1,7 @@
## 6.0.0
* Changed ForgotPasswordform to use the same layout as the EmailPasswordLoginForm.
* Add option for textalignment for email and password fields.
## 5.2.0

View file

@ -15,6 +15,8 @@ class LoginOptions {
this.maxFormWidth,
this.emailTextStyle,
this.passwordTextStyle,
this.emailTextAlign,
this.passwordTextAlign,
this.emailDecoration = const InputDecoration(),
this.passwordDecoration = const InputDecoration(),
this.initialEmail = '',
@ -88,6 +90,12 @@ class LoginOptions {
/// The text style for the password input field.
final TextStyle? passwordTextStyle;
/// The text alignment for the email input field.
final TextAlign? emailTextAlign;
/// The text alignment for the password input field.
final TextAlign? passwordTextAlign;
/// Translations for various texts on the login screen.
final LoginTranslations translations;

View file

@ -148,6 +148,8 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
children: [
options.emailInputContainerBuilder(
TextFormField(
textAlign:
options.emailTextAlign ?? TextAlign.start,
onChanged: _updateCurrentEmail,
validator: widget.options.validations.validateEmail,
initialValue: options.initialEmail,
@ -159,6 +161,8 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
),
options.passwordInputContainerBuilder(
TextFormField(
textAlign:
options.passwordTextAlign ?? TextAlign.start,
obscureText: _obscurePassword,
onChanged: _updateCurrentPassword,
validator:

View file

@ -122,6 +122,7 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
alignment: Alignment.center,
child: options.emailInputContainerBuilder(
TextFormField(
textAlign: options.emailTextAlign ?? TextAlign.start,
focusNode: _focusNode,
onChanged: _updateCurrentEmail,
validator: widget.options.validations.validateEmail,