mirror of
https://github.com/austinried/subtracks.git
synced 2025-12-27 00:59:28 +01:00
add autofill hints for source page
This commit is contained in:
parent
8fbc5e6ce4
commit
56dbcde3b4
@ -41,6 +41,7 @@ class SourcePage extends HookConsumerWidget {
|
|||||||
label: l.settingsServersFieldsAddress,
|
label: l.settingsServersFieldsAddress,
|
||||||
initialValue: source?.address.toString(),
|
initialValue: source?.address.toString(),
|
||||||
keyboardType: TextInputType.url,
|
keyboardType: TextInputType.url,
|
||||||
|
autofillHints: const [AutofillHints.url],
|
||||||
required: true,
|
required: true,
|
||||||
validator: (value, label) {
|
validator: (value, label) {
|
||||||
if (Uri.tryParse(value!) == null) {
|
if (Uri.tryParse(value!) == null) {
|
||||||
@ -52,12 +53,14 @@ class SourcePage extends HookConsumerWidget {
|
|||||||
final username = LabeledTextField(
|
final username = LabeledTextField(
|
||||||
label: l.settingsServersFieldsUsername,
|
label: l.settingsServersFieldsUsername,
|
||||||
initialValue: source?.username,
|
initialValue: source?.username,
|
||||||
|
autofillHints: const [AutofillHints.username],
|
||||||
required: true,
|
required: true,
|
||||||
);
|
);
|
||||||
final password = LabeledTextField(
|
final password = LabeledTextField(
|
||||||
label: l.settingsServersFieldsPassword,
|
label: l.settingsServersFieldsPassword,
|
||||||
initialValue: source?.password,
|
initialValue: source?.password,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
|
autofillHints: const [AutofillHints.password],
|
||||||
required: true,
|
required: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -175,26 +178,28 @@ class SourcePage extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
body: Form(
|
body: Form(
|
||||||
key: form,
|
key: form,
|
||||||
child: ListView(
|
child: AutofillGroup(
|
||||||
children: [
|
child: ListView(
|
||||||
const SizedBox(height: 96 - kToolbarHeight),
|
children: [
|
||||||
Padding(
|
const SizedBox(height: 96 - kToolbarHeight),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
Padding(
|
||||||
child: Text(
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
source == null
|
child: Text(
|
||||||
? l.settingsServersActionsAdd
|
source == null
|
||||||
: l.settingsServersActionsEdit,
|
? l.settingsServersActionsAdd
|
||||||
style: theme.textTheme.displaySmall,
|
: l.settingsServersActionsEdit,
|
||||||
|
style: theme.textTheme.displaySmall,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
name,
|
||||||
name,
|
address,
|
||||||
address,
|
username,
|
||||||
username,
|
password,
|
||||||
password,
|
const SizedBox(height: 24),
|
||||||
const SizedBox(height: 24),
|
forcePlaintextSwitch,
|
||||||
forcePlaintextSwitch,
|
const FabPadding(),
|
||||||
const FabPadding(),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -208,6 +213,7 @@ class LabeledTextField extends HookConsumerWidget {
|
|||||||
final bool obscureText;
|
final bool obscureText;
|
||||||
final bool required;
|
final bool required;
|
||||||
final TextInputType? keyboardType;
|
final TextInputType? keyboardType;
|
||||||
|
final Iterable<String>? autofillHints;
|
||||||
final String? Function(String? value, String label)? validator;
|
final String? Function(String? value, String label)? validator;
|
||||||
|
|
||||||
// ignore: prefer_const_constructors_in_immutables
|
// ignore: prefer_const_constructors_in_immutables
|
||||||
@ -218,6 +224,7 @@ class LabeledTextField extends HookConsumerWidget {
|
|||||||
this.obscureText = false,
|
this.obscureText = false,
|
||||||
this.keyboardType,
|
this.keyboardType,
|
||||||
this.validator,
|
this.validator,
|
||||||
|
this.autofillHints,
|
||||||
this.required = false,
|
this.required = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -249,6 +256,7 @@ class LabeledTextField extends HookConsumerWidget {
|
|||||||
controller: _controller,
|
controller: _controller,
|
||||||
obscureText: obscureText,
|
obscureText: obscureText,
|
||||||
keyboardType: keyboardType,
|
keyboardType: keyboardType,
|
||||||
|
autofillHints: autofillHints,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
String? error;
|
String? error;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user