websiteUrlFormEntry method
Implementation
Widget websiteUrlFormEntry({
String title = 'Website URL',
String subTitle = 'the website URL',
Function(String?)? onSaved,
String? defaultValue,
}) {
return formEntry(
title: title,
subTitle: subTitle,
inputWidget: TextFormField(
style: Theme.of(context).textTheme.bodyLarge,
onChanged: (_) {
widget.formKey.currentState!.save();
if (widget.onModified != null) {
widget.onModified!();
}
},
enabled: isEdit,
controller: TextEditingController(text: defaultValue),
decoration: elegantInputDecoration(
hintText: 'Website URL',
prefix: const Icon(Icons.web),
),
validator: (value) =>
value!.isValidUrl() || value.isEmpty ? null : 'Invalid URL',
onSaved: onSaved,
),
);
}