foodModeFormEntry method

Widget foodModeFormEntry({
  1. String title = 'Food Mode',
  2. String subTitle = 'Select the food modes available',
  3. dynamic onSeatingChanged(
    1. bool?
    )?,
  4. dynamic onDeliveryChanged(
    1. bool?
    )?,
  5. bool hasSeating = false,
  6. bool hasDelivery = false,
})

Implementation

Widget foodModeFormEntry({
  String title = 'Food Mode',
  String subTitle = 'Select the food modes available',
  Function(bool?)? onSeatingChanged,
  Function(bool?)? onDeliveryChanged,
  bool hasSeating = false,
  bool hasDelivery = false,
}) {
  return formEntry(
    title: title,
    subTitle: subTitle,
    inputWidget: Flex(
      direction: Axis.vertical,
      children: [
        CheckboxListTile(
          visualDensity: VisualDensity.compact,
          title: Text(
            'Dine-In',
            style: Theme.of(context).textTheme.bodyLarge,
          ),
          value: hasSeating,
          enabled: isEdit,
          onChanged: (value) {
            onSeatingChanged!(value);
            widget.formKey.currentState!.save();
            if (widget.onModified != null) {
              widget.onModified!();
            }
          },
        ),
        SizedBox(height: smallPadding),
        CheckboxListTile(
          enabled: isEdit,
          visualDensity: VisualDensity.compact,
          title: Text(
            'Delivery',
            style: Theme.of(context).textTheme.bodyLarge,
          ),
          value: hasDelivery,
          onChanged: (value) {
            onDeliveryChanged!(value);
            widget.formKey.currentState!.save();
            if (widget.onModified != null) {
              widget.onModified!();
            }
          },
        ),
      ],
    ),
  );
}