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 ## 6.0.0
* Changed ForgotPasswordform to use the same layout as the EmailPasswordLoginForm. * Changed ForgotPasswordform to use the same layout as the EmailPasswordLoginForm.
* Add option for textalignment for email and password fields.
## 5.2.0 ## 5.2.0

View file

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

View file

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

View file

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