datePickerTextBuilder function

Text datePickerTextBuilder(
  1. FastDatePickerState field
)

A FastDatePickerTextBuilder that is the default FastDatePicker.textBuilder.

Returns a Text widget that shows the current FastDatePickerState.value formatted according either to FastDatePicker.dateFormat or _datePickerFormat.

Implementation

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

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