Merge pull request #22 from Iconica-Development/feature/showPasswordOption

feat: added the options to disable the show password button
This commit is contained in:
Freek van de Ven 2023-11-29 09:42:32 +01:00 committed by GitHub
commit 15886ed5c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 14 deletions

View file

@ -1,3 +1,6 @@
## 5.1.0
* Added the option to disable the showPassword button on the passwordfield.
## 5.0.0 ## 5.0.0
* Removed the redundant initialEmail parameter from 'ForgotPasswordForm'. The only one to use now is the one in the 'LoginOptions'. * Removed the redundant initialEmail parameter from 'ForgotPasswordForm'. The only one to use now is the one in the 'LoginOptions'.

View file

@ -68,7 +68,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "4.2.0" version: "5.0.0"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter

View file

@ -28,6 +28,7 @@ class LoginOptions {
this.registrationButtonBuilder = _createRegisterButton, this.registrationButtonBuilder = _createRegisterButton,
this.emailInputContainerBuilder = _createEmailInputContainer, this.emailInputContainerBuilder = _createEmailInputContainer,
this.passwordInputContainerBuilder = _createPasswordInputContainer, this.passwordInputContainerBuilder = _createPasswordInputContainer,
this.showObscurePassword = true,
}); });
final ButtonBuilder loginButtonBuilder; final ButtonBuilder loginButtonBuilder;
@ -55,6 +56,7 @@ class LoginOptions {
final TextStyle? passwordTextStyle; final TextStyle? passwordTextStyle;
final LoginTranslations translations; final LoginTranslations translations;
final ValidationService? validationService; final ValidationService? validationService;
final bool showObscurePassword;
ValidationService get validations => ValidationService get validations =>
validationService ?? LoginValidationService(this); validationService ?? LoginValidationService(this);

View file

@ -161,10 +161,12 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
style: options.passwordTextStyle, style: options.passwordTextStyle,
onFieldSubmitted: (_) => _handleLogin(), onFieldSubmitted: (_) => _handleLogin(),
decoration: options.passwordDecoration.copyWith( decoration: options.passwordDecoration.copyWith(
suffixIcon: IconButton( suffixIcon: options.showObscurePassword
? IconButton(
onPressed: () { onPressed: () {
setState(() { setState(() {
_obscurePassword = !_obscurePassword; _obscurePassword =
!_obscurePassword;
}); });
}, },
icon: Icon( icon: Icon(
@ -172,7 +174,8 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
? Icons.visibility ? Icons.visibility
: Icons.visibility_off, : Icons.visibility_off,
), ),
), )
: null,
), ),
), ),
), ),

View file

@ -1,6 +1,6 @@
name: flutter_login name: flutter_login
description: Flutter Login Component description: Flutter Login Component
version: 5.0.0 version: 5.1.0
environment: environment:
sdk: ">=2.18.1 <3.0.0" sdk: ">=2.18.1 <3.0.0"