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
* 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: ".."
relative: true
source: path
version: "4.2.0"
version: "5.0.0"
flutter_test:
dependency: "direct dev"
description: flutter

View file

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

View file

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

View file

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