dateRangPickerTextBuilder function

Text dateRangPickerTextBuilder(
  1. FastDateRangePickerState field
)

Á FastDateRangePickerTextBuilder that is the default FastDateRangePicker.textBuilder.

Returns a Text widget that shows the current FastDateRangePickerState.value formatted according to FastDateRangePicker.dateFormat

Implementation

Text dateRangPickerTextBuilder(FastDateRangePickerState field) {
  final FastDateRangePickerState(:context, :enabled, :value, :widget) = field;
  final theme = Theme.of(context);
  final format = widget.dateFormat.format;
  final style = widget.textStyle ?? theme.textTheme.titleMedium;

  return Text(
    value != null ? '${format(value.start)} - ${format(value.end)}' : '',
    style: enabled ? style : style?.copyWith(color: theme.disabledColor),
    textAlign: TextAlign.left,
  );
}