feat: add textstyle for fields

This commit is contained in:
Freek van de Ven 2023-02-13 14:33:37 +01:00
parent 9f8fabb93a
commit a154140fc9
5 changed files with 14 additions and 4 deletions

View file

@ -1,3 +1,6 @@
## 3.1.2
* Added textStyle option for email and password fields
## 3.1.1 ## 3.1.1
* Fix login values not copied to validation * Fix login values not copied to validation

View file

@ -13,6 +13,8 @@ class LoginOptions {
this.passwordLabel, this.passwordLabel,
this.emailInputPrefix, this.emailInputPrefix,
this.passwordInputPrefix, this.passwordInputPrefix,
this.emailTextStyle,
this.passwordTextStyle,
this.decoration = const InputDecoration(), this.decoration = const InputDecoration(),
this.initialEmail = '', this.initialEmail = '',
this.initialPassword = '', this.initialPassword = '',
@ -48,6 +50,8 @@ class LoginOptions {
final String initialPassword; final String initialPassword;
final String? emailHintText; final String? emailHintText;
final String? passwordHintText; final String? passwordHintText;
final TextStyle? emailTextStyle;
final TextStyle? passwordTextStyle;
final LoginTranslations translations; final LoginTranslations translations;
final ValidationService? validationService; final ValidationService? validationService;

View file

@ -91,7 +91,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: _wrapWithDefaultStyle( child: _wrapWithDefaultStyle(
options.title, options.title,
theme.textTheme.headline6, theme.textTheme.headlineSmall,
), ),
) )
], ],
@ -103,7 +103,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: _wrapWithDefaultStyle( child: _wrapWithDefaultStyle(
options.subtitle, options.subtitle,
theme.textTheme.subtitle1, theme.textTheme.titleSmall,
), ),
) )
], ],
@ -132,6 +132,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
initialValue: options.initialEmail, initialValue: options.initialEmail,
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
style: options.emailTextStyle,
decoration: options.decoration.copyWith( decoration: options.decoration.copyWith(
hintText: options.emailHintText, hintText: options.emailHintText,
prefixIcon: options.emailInputPrefix, prefixIcon: options.emailInputPrefix,
@ -149,6 +150,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
initialValue: options.initialPassword, initialValue: options.initialPassword,
keyboardType: TextInputType.visiblePassword, keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
style: options.passwordTextStyle,
onFieldSubmitted: (_) => _handleLogin(), onFieldSubmitted: (_) => _handleLogin(),
decoration: options.decoration.copyWith( decoration: options.decoration.copyWith(
hintText: options.passwordHintText, hintText: options.passwordHintText,

View file

@ -106,6 +106,7 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
initialValue: options.initialEmail, initialValue: options.initialEmail,
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
style: options.emailTextStyle,
decoration: options.decoration.copyWith( decoration: options.decoration.copyWith(
prefixIcon: options.emailInputPrefix, prefixIcon: options.emailInputPrefix,
label: options.emailLabel, label: options.emailLabel,

View file

@ -1,6 +1,6 @@
name: flutter_login name: flutter_login
description: A new Flutter package project. description: Flutter Login Component
version: 3.1.1 version: 3.1.2
environment: environment:
sdk: ">=2.18.1 <3.0.0" sdk: ">=2.18.1 <3.0.0"