FLineCalendarStyle.inherit constructor

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

Creates a FLineCalendarStyle that inherits its properties from colorScheme and typography.

Implementation

factory FLineCalendarStyle.inherit({
  required FColorScheme colorScheme,
  required FTypography typography,
  required FStyle style,
}) {
  final focusedBorder = Border.all(color: colorScheme.primary, width: style.borderWidth);

  final selectedDateTextStyle = typography.xl.copyWith(
    color: colorScheme.primaryForeground,
    fontWeight: FontWeight.w500,
    height: 0,
  );

  final selectedWeekdayTextStyle = typography.xs.copyWith(
    color: colorScheme.primaryForeground,
    fontWeight: FontWeight.w500,
    height: 0,
  );

  final unselectedDateTextStyle = typography.xl.copyWith(
    color: colorScheme.primary,
    fontWeight: FontWeight.w500,
    height: 0,
  );
  final unselectedWeekdayTextStyle = typography.xs.copyWith(
    color: colorScheme.mutedForeground,
    fontWeight: FontWeight.w500,
    height: 0,
  );

  return FLineCalendarStyle(
    selectedItemStyle: FLineCalendarItemStyle(
      decoration: BoxDecoration(
        color: colorScheme.primary,
        borderRadius: style.borderRadius,
      ),
      focusedDecoration: BoxDecoration(
        color: colorScheme.primary,
        border: focusedBorder,
        borderRadius: style.borderRadius,
      ),
      todayIndicatorColor: colorScheme.primaryForeground,
      dateTextStyle: selectedDateTextStyle,
      weekdayTextStyle: selectedWeekdayTextStyle,
    ),
    selectedHoveredItemStyle: FLineCalendarItemStyle(
      decoration: BoxDecoration(
        color: colorScheme.hover(colorScheme.primary),
        borderRadius: style.borderRadius,
      ),
      focusedDecoration: BoxDecoration(
        color: colorScheme.hover(colorScheme.primary),
        border: focusedBorder,
        borderRadius: style.borderRadius,
      ),
      todayIndicatorColor: colorScheme.hover(colorScheme.primaryForeground),
      dateTextStyle: selectedDateTextStyle,
      weekdayTextStyle: selectedWeekdayTextStyle,
    ),
    unselectedItemStyle: FLineCalendarItemStyle(
      decoration: BoxDecoration(
        color: colorScheme.background,
        border: Border.all(color: colorScheme.border),
        borderRadius: style.borderRadius,
      ),
      focusedDecoration: BoxDecoration(
        color: colorScheme.background,
        border: focusedBorder,
        borderRadius: style.borderRadius,
      ),
      todayIndicatorColor: colorScheme.primary,
      dateTextStyle: unselectedDateTextStyle,
      weekdayTextStyle: unselectedWeekdayTextStyle,
    ),
    unselectedHoveredItemStyle: FLineCalendarItemStyle(
      decoration: BoxDecoration(
        color: colorScheme.secondary,
        border: Border.all(color: colorScheme.border),
        borderRadius: style.borderRadius,
      ),
      focusedDecoration: BoxDecoration(
        color: colorScheme.secondary,
        border: focusedBorder,
        borderRadius: style.borderRadius,
      ),
      todayIndicatorColor: colorScheme.hover(colorScheme.primary),
      dateTextStyle: unselectedDateTextStyle,
      weekdayTextStyle: unselectedWeekdayTextStyle,
    ),
  );
}