FLineCalendarStyle.inherit constructor

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

Creates a FLineCalendarStyle that inherits its properties.

Implementation

factory FLineCalendarStyle.inherit({
  required FColors colors,
  required FTypography typography,
  required FStyle style,
}) {
  final focusedBorder = Border.all(color: colors.primary, width: style.borderWidth);
  return FLineCalendarStyle(
    decoration: FWidgetStateMap({
      WidgetState.selected & (WidgetState.hovered | WidgetState.pressed) & WidgetState.focused: BoxDecoration(
        color: colors.hover(colors.primary),
        border: focusedBorder,
        borderRadius: style.borderRadius,
      ),
      WidgetState.selected & (WidgetState.hovered | WidgetState.pressed): BoxDecoration(
        color: colors.hover(colors.primary),
        borderRadius: style.borderRadius,
      ),
      WidgetState.selected & WidgetState.focused: BoxDecoration(
        color: colors.primary,
        border: focusedBorder,
        borderRadius: style.borderRadius,
      ),
      WidgetState.selected: BoxDecoration(color: colors.primary, borderRadius: style.borderRadius),
      (WidgetState.hovered | WidgetState.pressed) & WidgetState.focused: BoxDecoration(
        color: colors.secondary,
        border: focusedBorder,
        borderRadius: style.borderRadius,
      ),
      (WidgetState.hovered | WidgetState.pressed): BoxDecoration(
        color: colors.secondary,
        border: Border.all(color: colors.border),
        borderRadius: style.borderRadius,
      ),
      WidgetState.focused: BoxDecoration(
        color: colors.background,
        border: focusedBorder,
        borderRadius: style.borderRadius,
      ),
      WidgetState.any: BoxDecoration(
        color: colors.background,
        border: Border.all(color: colors.border),
        borderRadius: style.borderRadius,
      ),
    }),
    todayIndicatorColor: FWidgetStateMap({
      WidgetState.selected & (WidgetState.hovered | WidgetState.pressed): colors.hover(colors.primaryForeground),
      WidgetState.selected: colors.primaryForeground,
      (WidgetState.hovered | WidgetState.pressed): colors.hover(colors.primary),
      WidgetState.any: colors.primary,
    }),
    dateTextStyle: FWidgetStateMap({
      WidgetState.selected: typography.xl.copyWith(
        color: colors.primaryForeground,
        fontWeight: FontWeight.w500,
        height: 0,
      ),
      WidgetState.any: typography.xl.copyWith(color: colors.primary, fontWeight: FontWeight.w500, height: 0),
    }),
    weekdayTextStyle: FWidgetStateMap({
      WidgetState.selected: typography.xs.copyWith(
        color: colors.primaryForeground,
        fontWeight: FontWeight.w500,
        height: 0,
      ),
      WidgetState.any: typography.xs.copyWith(color: colors.mutedForeground, fontWeight: FontWeight.w500, height: 0),
    }),
    tappableStyle: style.tappableStyle,
  );
}