improve url validation in settings

This commit is contained in:
Joel Calado 2023-05-12 19:04:01 +01:00 committed by austinried
parent 1c76293559
commit 52b51954aa

View File

@ -45,10 +45,10 @@ class SourcePage extends HookConsumerWidget {
autofillHints: const [AutofillHints.url], autofillHints: const [AutofillHints.url],
required: true, required: true,
validator: (value, label) { validator: (value, label) {
if (Uri.tryParse(value!) == null) { if (Uri.tryParse(value!)?.isAbsolute == false ||
!value.contains('http')) {
return '$label must be a valid URL'; return '$label must be a valid URL';
} }
return null;
}, },
); );
final username = LabeledTextField( final username = LabeledTextField(