descriptionFormEntry method

Widget descriptionFormEntry({
  1. String title = 'Description',
  2. String subTitle = 'the description of your meal that will be displayed below the name',
  3. dynamic onSaved(
    1. String?
    )?,
  4. dynamic onChanged(
    1. String?
    )?,
  5. int maxLines = 1,
  6. String? defaultValue,
})

Implementation

Widget descriptionFormEntry({
  String title = 'Description',
  String subTitle =
      'the description of your meal that will be displayed below the name',
  Function(String?)? onSaved,
  Function(String?)? onChanged,
  int maxLines = 1,
  String? defaultValue,
}) {
  return formEntry(
    title: title,
    subTitle: subTitle,
    inputWidget: TextFormField(
      maxLines: maxLines,
      onChanged: (value) {
        widget.formKey.currentState!.save();
        if (widget.onModified != null) {
          widget.onModified!();
        }
        onChanged?.call(value);
      },
      style: Theme.of(context).textTheme.bodyLarge,
      enabled: isEdit,
      controller: TextEditingController(text: defaultValue),
      decoration: elegantInputDecoration(
        hintText: 'Description',
        prefix: const Icon(Icons.description),
      ).copyWith(alignLabelWithHint: true),
      onSaved: onSaved,
    ),
  );
}