FCalendarDayStyles.inherit constructor
FCalendarDayStyles.inherit({
- required FColors colors,
- required FTypography typography,
- required FStyle style,
Creates a FCalendarDayStyles that inherits its properties.
Implementation
factory FCalendarDayStyles.inherit({
required FColors colors,
required FTypography typography,
required FStyle style,
}) {
final base = FCalendarDayStyle(
textStyle: typography.body.sm.copyWith(color: colors.foreground),
foreground: ShapeDecoration(shape: RoundedSuperellipseBorder(borderRadius: style.borderRadius.md)),
);
final focused = BorderSide(color: colors.primary, width: style.borderWidth);
final selectedFocused = BorderSide(color: colors.border, width: style.borderWidth);
final start = RoundedSuperellipseBorder(borderRadius: .horizontal(start: style.borderRadius.md.topLeft));
final end = RoundedSuperellipseBorder(borderRadius: .horizontal(end: style.borderRadius.md.topLeft));
return FCalendarDayStyles(
FVariants.from(
base,
variants: {
[.focused]: .delta(
foreground: .shapeDelta(
shape: RoundedSuperellipseBorder(side: focused, borderRadius: style.borderRadius.md),
),
),
[.focused.and(.hovered), .focused.and(.pressed)]: .delta(
textStyle: .delta(color: colors.secondaryForeground),
foreground: .shapeDelta(
color: colors.secondary,
shape: RoundedSuperellipseBorder(side: focused, borderRadius: style.borderRadius.md),
),
),
[.hovered, .pressed]: .delta(
textStyle: .delta(color: colors.secondaryForeground),
foreground: .shapeDelta(color: colors.secondary),
),
//
[.disabled]: .delta(textStyle: .delta(color: colors.disable(colors.mutedForeground))),
//
[.today]: .delta(textStyle: .delta(decoration: () => .underline)),
[.today.and(.hovered), .today.and(.pressed)]: .delta(
textStyle: .delta(color: colors.secondaryForeground, decoration: () => .underline),
foreground: .shapeDelta(color: colors.secondary),
),
[.today.and(.focused)]: .delta(
textStyle: .delta(decoration: () => .underline),
foreground: .shapeDelta(
shape: RoundedSuperellipseBorder(side: focused, borderRadius: style.borderRadius.md),
),
),
[.today.and(.focused).and(.hovered), .today.and(.focused).and(.pressed)]: .delta(
textStyle: .delta(color: colors.secondaryForeground, decoration: () => .underline),
foreground: .shapeDelta(
color: colors.secondary,
shape: RoundedSuperellipseBorder(side: focused, borderRadius: style.borderRadius.md),
),
),
[.today.and(.disabled)]: .delta(
textStyle: .delta(color: colors.disable(colors.mutedForeground), decoration: () => .underline),
),
//
[.adjacent]: .delta(textStyle: .delta(color: colors.mutedForeground)),
[.adjacent.and(.hovered), .adjacent.and(.pressed)]: .delta(
textStyle: .delta(color: colors.secondaryForeground),
foreground: .shapeDelta(color: colors.secondary),
),
[.adjacent.and(.focused)]: .delta(
textStyle: .delta(color: colors.mutedForeground),
foreground: .shapeDelta(
shape: RoundedSuperellipseBorder(side: focused, borderRadius: style.borderRadius.md),
),
),
[.adjacent.and(.focused).and(.hovered), .adjacent.and(.focused).and(.pressed)]: .delta(
textStyle: .delta(color: colors.secondaryForeground),
foreground: .shapeDelta(
color: colors.secondary,
shape: RoundedSuperellipseBorder(side: focused, borderRadius: style.borderRadius.md),
),
),
[.adjacent.and(.disabled)]: .delta(textStyle: .delta(color: colors.disable(colors.mutedForeground))),
[.adjacent.and(.today)]: .delta(
textStyle: .delta(color: colors.mutedForeground, decoration: () => .underline),
),
[.adjacent.and(.today).and(.hovered), .adjacent.and(.today).and(.pressed)]: .delta(
textStyle: .delta(color: colors.secondaryForeground, decoration: () => .underline),
foreground: .shapeDelta(color: colors.secondary),
),
[.adjacent.and(.today).and(.focused)]: .delta(
textStyle: .delta(color: colors.mutedForeground, decoration: () => .underline),
foreground: .shapeDelta(
shape: RoundedSuperellipseBorder(side: focused, borderRadius: style.borderRadius.md),
),
),
[
.adjacent.and(.today).and(.focused).and(.hovered),
.adjacent.and(.today).and(.focused).and(.pressed),
]: .delta(
textStyle: .delta(color: colors.secondaryForeground, decoration: () => .underline),
foreground: .shapeDelta(
color: colors.secondary,
shape: RoundedSuperellipseBorder(side: focused, borderRadius: style.borderRadius.md),
),
),
[.adjacent.and(.today).and(.disabled)]: .delta(
textStyle: .delta(color: colors.disable(colors.mutedForeground), decoration: () => .underline),
),
//
[.single]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(color: colors.primary),
),
[.single.and(.hovered), .single.and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(color: colors.hover(colors.primary)),
),
[.single.and(.focused)]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(
color: colors.primary,
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
),
[.single.and(.focused).and(.hovered), .single.and(.focused).and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(
color: colors.hover(colors.primary),
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
),
[.single.and(.disabled)]: .delta(
textStyle: .delta(color: colors.disable(colors.primaryForeground)),
foreground: .shapeDelta(color: colors.primary),
),
[.single.and(.today)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(color: colors.primary),
),
[.single.and(.today).and(.hovered), .single.and(.today).and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(color: colors.hover(colors.primary)),
),
[.single.and(.today).and(.focused)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(
color: colors.primary,
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
),
[.single.and(.today).and(.focused).and(.hovered), .single.and(.today).and(.focused).and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(
color: colors.hover(colors.primary),
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
),
[.single.and(.today).and(.disabled)]: .delta(
textStyle: .delta(color: colors.disable(colors.primaryForeground), decoration: () => .underline),
foreground: .shapeDelta(color: colors.primary),
),
//
// The start of a contiguous selection: a primary chip over a bar rounded on the leading edge.
[.start]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(color: colors.primary),
background: .shapeDelta(color: colors.secondary, shape: start),
),
[.start.and(.hovered), .start.and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(color: colors.hover(colors.primary)),
background: .shapeDelta(color: colors.secondary, shape: start),
),
[.start.and(.focused)]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(
color: colors.primary,
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
background: .shapeDelta(color: colors.secondary, shape: start),
),
[.start.and(.focused).and(.hovered), .start.and(.focused).and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(
color: colors.hover(colors.primary),
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
background: .shapeDelta(color: colors.secondary, shape: start),
),
[.start.and(.disabled)]: .delta(
textStyle: .delta(color: colors.disable(colors.primaryForeground)),
foreground: .shapeDelta(color: colors.primary),
background: .shapeDelta(color: colors.secondary, shape: start),
),
[.start.and(.today)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(color: colors.primary),
background: .shapeDelta(color: colors.secondary, shape: start),
),
[.start.and(.today).and(.hovered), .start.and(.today).and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(color: colors.hover(colors.primary)),
background: .shapeDelta(color: colors.secondary, shape: start),
),
[.start.and(.today).and(.focused)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(
color: colors.primary,
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
background: .shapeDelta(color: colors.secondary, shape: start),
),
[.start.and(.today).and(.focused).and(.hovered), .start.and(.today).and(.focused).and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(
color: colors.hover(colors.primary),
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
background: .shapeDelta(color: colors.secondary, shape: start),
),
[.start.and(.today).and(.disabled)]: .delta(
textStyle: .delta(color: colors.disable(colors.primaryForeground), decoration: () => .underline),
foreground: .shapeDelta(color: colors.primary),
background: .shapeDelta(color: colors.secondary, shape: start),
),
//
// The end of a contiguous selection: same as start, but the bar rounds on the trailing edge.
[.end]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(color: colors.primary),
background: .shapeDelta(color: colors.secondary, shape: end),
),
[.end.and(.hovered), .end.and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(color: colors.hover(colors.primary)),
background: .shapeDelta(color: colors.secondary, shape: end),
),
[.end.and(.focused)]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(
color: colors.primary,
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
background: .shapeDelta(color: colors.secondary, shape: end),
),
[.end.and(.focused).and(.hovered), .end.and(.focused).and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground),
foreground: .shapeDelta(
color: colors.hover(colors.primary),
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
background: .shapeDelta(color: colors.secondary, shape: end),
),
[.end.and(.disabled)]: .delta(
textStyle: .delta(color: colors.disable(colors.primaryForeground)),
foreground: .shapeDelta(color: colors.primary),
background: .shapeDelta(color: colors.secondary, shape: end),
),
[.end.and(.today)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(color: colors.primary),
background: .shapeDelta(color: colors.secondary, shape: end),
),
[.end.and(.today).and(.hovered), .end.and(.today).and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(color: colors.hover(colors.primary)),
background: .shapeDelta(color: colors.secondary, shape: end),
),
[.end.and(.today).and(.focused)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(
color: colors.primary,
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
background: .shapeDelta(color: colors.secondary, shape: end),
),
[.end.and(.today).and(.focused).and(.hovered), .end.and(.today).and(.focused).and(.pressed)]: .delta(
textStyle: .delta(color: colors.primaryForeground, decoration: () => .underline),
foreground: .shapeDelta(
color: colors.hover(colors.primary),
shape: RoundedSuperellipseBorder(side: selectedFocused, borderRadius: style.borderRadius.md),
),
background: .shapeDelta(color: colors.secondary, shape: end),
),
[.end.and(.today).and(.disabled)]: .delta(
textStyle: .delta(color: colors.disable(colors.primaryForeground), decoration: () => .underline),
foreground: .shapeDelta(color: colors.primary),
background: .shapeDelta(color: colors.secondary, shape: end),
),
//
[.middle]: .delta(
textStyle: .delta(color: colors.secondaryForeground),
foreground: .boxDelta(color: colors.secondary, borderRadius: .zero),
),
[.middle.and(.hovered), .middle.and(.pressed)]: .delta(
textStyle: .delta(color: colors.secondaryForeground),
foreground: .boxDelta(color: colors.hover(colors.secondary), borderRadius: .zero),
),
[.middle.and(.focused)]: .delta(
textStyle: .delta(color: colors.secondaryForeground),
foreground: .boxDelta(color: colors.secondary, borderRadius: .zero, border: Border.fromBorderSide(focused)),
),
[.middle.and(.focused).and(.hovered), .middle.and(.focused).and(.pressed)]: .delta(
textStyle: .delta(color: colors.secondaryForeground),
foreground: .boxDelta(
color: colors.hover(colors.secondary),
borderRadius: .zero,
border: Border.fromBorderSide(focused),
),
),
[.middle.and(.disabled)]: .delta(
textStyle: .delta(color: colors.disable(colors.secondaryForeground)),
foreground: .boxDelta(color: colors.secondary, borderRadius: .zero),
),
[.middle.and(.today)]: .delta(
textStyle: .delta(color: colors.secondaryForeground, decoration: () => .underline),
foreground: .boxDelta(color: colors.secondary, borderRadius: .zero),
),
[.middle.and(.today).and(.hovered), .middle.and(.today).and(.pressed)]: .delta(
textStyle: .delta(color: colors.secondaryForeground, decoration: () => .underline),
foreground: .boxDelta(color: colors.hover(colors.secondary), borderRadius: .zero),
),
[.middle.and(.today).and(.focused)]: .delta(
textStyle: .delta(color: colors.secondaryForeground, decoration: () => .underline),
foreground: .boxDelta(color: colors.secondary, borderRadius: .zero, border: Border.fromBorderSide(focused)),
),
[.middle.and(.today).and(.focused).and(.hovered), .middle.and(.today).and(.focused).and(.pressed)]: .delta(
textStyle: .delta(color: colors.secondaryForeground, decoration: () => .underline),
foreground: .boxDelta(
color: colors.hover(colors.secondary),
borderRadius: .zero,
border: Border.fromBorderSide(focused),
),
),
[.middle.and(.today).and(.disabled)]: .delta(
textStyle: .delta(color: colors.disable(colors.secondaryForeground), decoration: () => .underline),
foreground: .boxDelta(color: colors.secondary, borderRadius: .zero),
),
},
),
);
}