Control.dateRange constructor

Control.dateRange({
  1. required String key,
  2. String? title,
  3. String? description,
  4. void onChange(
    1. dynamic
    )?,
  5. DateTimeRange? value,
  6. DateTime? min,
  7. DateTime? max,
  8. Widget? prefixIcon,
})

Implementation

factory Control.dateRange({
  required String key,
  String? title,
  String? description,
  void Function(dynamic)? onChange,
  DateTimeRange? value,
  DateTime? min,
  DateTime? max,
  Widget? prefixIcon,
}) =>
    Control(
      key: key,
      type: ControlType.dateRange,
      title: title,
      description: description,
      onChange: onChange,
      value: <String, DateTime?>{
        'selected-start': value?.start ?? DateTime.now(),
        'selected-end':
            value?.end ?? DateTime.now().add(const Duration(days: 1)),
        'min': min ?? value?.start ?? DateTime.now(),
        'max': max ??
            (min ?? value?.start ?? DateTime.now())
                .add(const Duration(days: 365)),
      },
      prefixIcon: prefixIcon,
    );