From 8de2196b61cd22981284aa6c22bd0af64f89742a Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Sun, 15 Oct 2023 10:52:56 +0600 Subject: [PATCH] chore: add lastfm login field autofill support --- lib/pages/lastfm_login/lastfm_login.dart | 57 +++++++++++++++--------- lib/themes/theme.dart | 1 - 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/lib/pages/lastfm_login/lastfm_login.dart b/lib/pages/lastfm_login/lastfm_login.dart index bea43b55..f77d0abb 100644 --- a/lib/pages/lastfm_login/lastfm_login.dart +++ b/lib/pages/lastfm_login/lastfm_login.dart @@ -59,29 +59,42 @@ class LastFMLoginPage extends HookConsumerWidget { const SizedBox(height: 10), Text(context.l10n.login_with_your_lastfm), const SizedBox(height: 10), - TextFormField( - controller: username, - validator: ValidationBuilder().required().build(), - decoration: InputDecoration( - labelText: context.l10n.username, - ), - ), - const SizedBox(height: 10), - TextFormField( - controller: password, - validator: ValidationBuilder().required().build(), - obscureText: !passwordVisible.value, - decoration: InputDecoration( - labelText: context.l10n.password, - suffixIcon: IconButton( - icon: Icon( - passwordVisible.value - ? SpotubeIcons.eye - : SpotubeIcons.noEye, + AutofillGroup( + child: Column( + children: [ + TextFormField( + autofillHints: const [ + AutofillHints.username, + AutofillHints.email, + ], + controller: username, + validator: ValidationBuilder().required().build(), + decoration: InputDecoration( + labelText: context.l10n.username, + ), ), - onPressed: () => - passwordVisible.value = !passwordVisible.value, - ), + const SizedBox(height: 10), + TextFormField( + autofillHints: const [ + AutofillHints.password, + ], + controller: password, + validator: ValidationBuilder().required().build(), + obscureText: !passwordVisible.value, + decoration: InputDecoration( + labelText: context.l10n.password, + suffixIcon: IconButton( + icon: Icon( + passwordVisible.value + ? SpotubeIcons.eye + : SpotubeIcons.noEye, + ), + onPressed: () => passwordVisible.value = + !passwordVisible.value, + ), + ), + ), + ], ), ), const SizedBox(height: 10), diff --git a/lib/themes/theme.dart b/lib/themes/theme.dart index 42420e8c..8c968e1b 100644 --- a/lib/themes/theme.dart +++ b/lib/themes/theme.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter_desktop_tools/flutter_desktop_tools.dart'; ThemeData theme(Color seed, Brightness brightness, bool isAmoled) { final scheme = ColorScheme.fromSeed(