mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-20 02:59:26 +01:00
fix: Password not obscure for a second when submitting login textfield
This commit is contained in:
parent
1c0a17056f
commit
38d65ba3ed
@ -27,7 +27,8 @@ class LoginController extends State<Login> {
|
|||||||
bool loading = false;
|
bool loading = false;
|
||||||
bool showPassword = false;
|
bool showPassword = false;
|
||||||
|
|
||||||
void toggleShowPassword() => setState(() => showPassword = !showPassword);
|
void toggleShowPassword() =>
|
||||||
|
setState(() => showPassword = !loading && !showPassword);
|
||||||
|
|
||||||
void login([_]) async {
|
void login([_]) async {
|
||||||
final matrix = Matrix.of(context);
|
final matrix = Matrix.of(context);
|
||||||
|
@ -58,16 +58,16 @@ class LoginView extends StatelessWidget {
|
|||||||
autofillHints:
|
autofillHints:
|
||||||
controller.loading ? null : [AutofillHints.password],
|
controller.loading ? null : [AutofillHints.password],
|
||||||
controller: controller.passwordController,
|
controller: controller.passwordController,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.go,
|
||||||
obscureText: !controller.showPassword,
|
obscureText: !controller.showPassword,
|
||||||
onSubmitted: controller.login,
|
onSubmitted: controller.login,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
prefixIcon: const Icon(Icons.lock_outlined),
|
prefixIcon: const Icon(Icons.lock_outlined),
|
||||||
errorText: controller.passwordError,
|
errorText: controller.passwordError,
|
||||||
errorStyle: const TextStyle(color: Colors.orange),
|
errorStyle: const TextStyle(color: Colors.orange),
|
||||||
suffixIcon: InkWell(
|
suffixIcon: IconButton(
|
||||||
onTap: controller.toggleShowPassword,
|
onPressed: controller.toggleShowPassword,
|
||||||
child: Icon(
|
icon: Icon(
|
||||||
controller.showPassword
|
controller.showPassword
|
||||||
? Icons.visibility_off_outlined
|
? Icons.visibility_off_outlined
|
||||||
: Icons.visibility_outlined,
|
: Icons.visibility_outlined,
|
||||||
|
Loading…
Reference in New Issue
Block a user