chore: add lastfm login field autofill support

This commit is contained in:
Kingkor Roy Tirtho 2023-10-15 10:52:56 +06:00
parent 34b80a36b4
commit 8de2196b61
2 changed files with 35 additions and 23 deletions

View File

@ -59,7 +59,14 @@ class LastFMLoginPage extends HookConsumerWidget {
const SizedBox(height: 10), const SizedBox(height: 10),
Text(context.l10n.login_with_your_lastfm), Text(context.l10n.login_with_your_lastfm),
const SizedBox(height: 10), const SizedBox(height: 10),
AutofillGroup(
child: Column(
children: [
TextFormField( TextFormField(
autofillHints: const [
AutofillHints.username,
AutofillHints.email,
],
controller: username, controller: username,
validator: ValidationBuilder().required().build(), validator: ValidationBuilder().required().build(),
decoration: InputDecoration( decoration: InputDecoration(
@ -68,6 +75,9 @@ class LastFMLoginPage extends HookConsumerWidget {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
TextFormField( TextFormField(
autofillHints: const [
AutofillHints.password,
],
controller: password, controller: password,
validator: ValidationBuilder().required().build(), validator: ValidationBuilder().required().build(),
obscureText: !passwordVisible.value, obscureText: !passwordVisible.value,
@ -79,11 +89,14 @@ class LastFMLoginPage extends HookConsumerWidget {
? SpotubeIcons.eye ? SpotubeIcons.eye
: SpotubeIcons.noEye, : SpotubeIcons.noEye,
), ),
onPressed: () => onPressed: () => passwordVisible.value =
passwordVisible.value = !passwordVisible.value, !passwordVisible.value,
), ),
), ),
), ),
],
),
),
const SizedBox(height: 10), const SizedBox(height: 10),
FilledButton( FilledButton(
onPressed: isLoading.value onPressed: isLoading.value

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_desktop_tools/flutter_desktop_tools.dart';
ThemeData theme(Color seed, Brightness brightness, bool isAmoled) { ThemeData theme(Color seed, Brightness brightness, bool isAmoled) {
final scheme = ColorScheme.fromSeed( final scheme = ColorScheme.fromSeed(