From 38d65ba3ed0735e9d7f1fee528fdcdad668d8e8e Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sun, 13 Nov 2022 12:01:11 +0100 Subject: [PATCH] fix: Password not obscure for a second when submitting login textfield --- lib/pages/login/login.dart | 3 ++- lib/pages/login/login_view.dart | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index a46db248..126b3a66 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -27,7 +27,8 @@ class LoginController extends State { bool loading = false; bool showPassword = false; - void toggleShowPassword() => setState(() => showPassword = !showPassword); + void toggleShowPassword() => + setState(() => showPassword = !loading && !showPassword); void login([_]) async { final matrix = Matrix.of(context); diff --git a/lib/pages/login/login_view.dart b/lib/pages/login/login_view.dart index f76cc3ed..a2b1afc8 100644 --- a/lib/pages/login/login_view.dart +++ b/lib/pages/login/login_view.dart @@ -58,16 +58,16 @@ class LoginView extends StatelessWidget { autofillHints: controller.loading ? null : [AutofillHints.password], controller: controller.passwordController, - textInputAction: TextInputAction.next, + textInputAction: TextInputAction.go, obscureText: !controller.showPassword, onSubmitted: controller.login, decoration: InputDecoration( prefixIcon: const Icon(Icons.lock_outlined), errorText: controller.passwordError, errorStyle: const TextStyle(color: Colors.orange), - suffixIcon: InkWell( - onTap: controller.toggleShowPassword, - child: Icon( + suffixIcon: IconButton( + onPressed: controller.toggleShowPassword, + icon: Icon( controller.showPassword ? Icons.visibility_off_outlined : Icons.visibility_outlined,