TimeIndicatorStyle constructor

TimeIndicatorStyle(
  1. BuildContext context,
  2. Duration time, {
  3. TextStyle? textStyle,
  4. String? label,
  5. bool alwaysUse24HourFormat = false,
})

Implementation

factory TimeIndicatorStyle(
  BuildContext context,
  Duration time, {
  TextStyle? textStyle,
  String? label,
  bool alwaysUse24HourFormat = false,
}) {
  assert(time.debugCheckIsValidTimetableTimeOfDay());

  final theme = context.theme;
  final bodySmall = theme.textTheme.bodySmall!;
  final proportionalFiguresFeature = const FontFeature.proportionalFigures().value;
  return TimeIndicatorStyle.raw(
    textStyle: textStyle ??
        bodySmall.copyWith(
          color: theme.colorScheme.background.disabledOnColor,
          fontFeatures: [
            ...?bodySmall.fontFeatures?.where((it) => it.value != proportionalFiguresFeature),
            const FontFeature.tabularFigures(),
          ],
        ),
    label: label ??
        () {
          context.dependOnTimetableLocalizations();
          return alwaysUse24HourFormat ? TimeIndicator.formatHour24(time) : TimeIndicator.formatHour(time);
        }(),
  );
}