websiteUrlFormEntry method

Widget websiteUrlFormEntry({
  1. String title = 'Website URL',
  2. String subTitle = 'the website URL',
  3. dynamic onSaved(
    1. String?
    )?,
  4. String? defaultValue,
})

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,
    ),
  );
}