DateIndicatorStyle constructor
DateIndicatorStyle(
- BuildContext context,
- DateTime date, {
- Decoration? decoration,
- EdgeInsetsGeometry? padding,
- TextStyle? textStyle,
- String? label,
Implementation
factory DateIndicatorStyle(
BuildContext context,
DateTime date, {
Decoration? decoration,
EdgeInsetsGeometry? padding,
TextStyle? textStyle,
String? label,
}) {
assert(date.debugCheckIsValidTimetableDate());
final today = DateTimeTimetable.today();
final isInFuture = date > today;
final isToday = date == today;
final theme = context.theme;
return DateIndicatorStyle.raw(
decoration: decoration ??
BoxDecoration(
shape: BoxShape.circle,
color: isToday ? theme.colorScheme.primary : Colors.transparent,
),
padding: padding ?? const EdgeInsets.all(8),
textStyle: textStyle ??
context.textTheme.titleMedium!.copyWith(
color: isToday
? theme.colorScheme.primary.highEmphasisOnColor
: isInFuture
? theme.colorScheme.background.contrastColor
: theme.colorScheme.background.mediumEmphasisOnColor,
),
label: label ??
() {
context.dependOnTimetableLocalizations();
return DateFormat('d').format(date);
}(),
);
}