FCalendarYearStyles.inherit constructor

FCalendarYearStyles.inherit({
  1. required FColors colors,
  2. required FTypography typography,
  3. required FStyle style,
})

Creates a FCalendarYearStyles that inherits its properties.

Implementation

factory FCalendarYearStyles.inherit({
  required FColors colors,
  required FTypography typography,
  required FStyle style,
}) {
  final base = FCalendarYearStyle(
    textStyle: typography.body.sm.copyWith(color: colors.foreground),
    decoration: ShapeDecoration(shape: RoundedSuperellipseBorder(borderRadius: style.borderRadius.md)),
  );

  final focused = BorderSide(color: colors.primary, width: style.borderWidth);

  return FCalendarYearStyles(
    FVariants.from(
      base,
      variants: {
        [.focused]: .delta(
          decoration: .shapeDelta(
            shape: RoundedSuperellipseBorder(side: focused, borderRadius: style.borderRadius.md),
          ),
        ),
        [.focused.and(.hovered), .focused.and(.pressed)]: .delta(
          textStyle: .delta(color: colors.secondaryForeground),
          decoration: .shapeDelta(
            color: colors.secondary,
            shape: RoundedSuperellipseBorder(side: focused, borderRadius: style.borderRadius.md),
          ),
        ),
        [.hovered, .pressed]: .delta(
          textStyle: .delta(color: colors.secondaryForeground),
          decoration: .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),
          decoration: .shapeDelta(color: colors.secondary),
        ),
        [.today.and(.focused)]: .delta(
          textStyle: .delta(decoration: () => .underline),
          decoration: .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),
          decoration: .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),
        ),
      },
    ),
  );
}