FCalendarDayPickerStyle.inherit constructor

FCalendarDayPickerStyle.inherit({
  1. required FColorScheme colorScheme,
  2. required FTypography typography,
})

Creates a FCalendarDayPickerStyle that inherits from the given colorScheme and typography.

Implementation

factory FCalendarDayPickerStyle.inherit({
  required FColorScheme colorScheme,
  required FTypography typography,
}) {
  final textStyle = typography.base.copyWith(color: colorScheme.foreground, fontWeight: FontWeight.w500);
  final mutedTextStyle = typography.base.copyWith(
    color: colorScheme.disable(colorScheme.mutedForeground),
    fontWeight: FontWeight.w500,
  );

  final disabled = FCalendarDayStyle(
    selectedStyle: FCalendarEntryStyle(
      backgroundColor: colorScheme.primaryForeground,
      textStyle: mutedTextStyle,
      focusedBorderColor: colorScheme.primaryForeground,
      radius: const Radius.circular(4),
    ),
    unselectedStyle: FCalendarEntryStyle(
      backgroundColor: colorScheme.background,
      textStyle: mutedTextStyle,
      focusedBorderColor: colorScheme.background,
      radius: const Radius.circular(4),
    ),
  );

  return FCalendarDayPickerStyle(
    headerTextStyle: typography.xs.copyWith(color: colorScheme.mutedForeground),
    selectableStyles: (
      current: FCalendarDayStyle(
        selectedStyle: FCalendarEntryStyle(
          backgroundColor: colorScheme.foreground,
          textStyle: typography.base.copyWith(color: colorScheme.background, fontWeight: FontWeight.w500),
          focusedBorderColor: colorScheme.foreground,
          radius: const Radius.circular(4),
        ),
        unselectedStyle: FCalendarEntryStyle(
          backgroundColor: colorScheme.background,
          textStyle: textStyle,
          hoveredBackgroundColor: colorScheme.secondary,
          focusedBorderColor: colorScheme.foreground,
          radius: const Radius.circular(4),
        ),
      ),
      enclosing: FCalendarDayStyle(
        selectedStyle: FCalendarEntryStyle(
          backgroundColor: colorScheme.primaryForeground,
          textStyle: mutedTextStyle,
          focusedBorderColor: colorScheme.foreground,
          radius: const Radius.circular(4),
        ),
        unselectedStyle: FCalendarEntryStyle(
          backgroundColor: colorScheme.background,
          textStyle: mutedTextStyle,
          hoveredBackgroundColor: colorScheme.secondary,
          focusedBorderColor: colorScheme.foreground,
          radius: const Radius.circular(4),
        ),
      ),
    ),
    unselectableStyles: (current: disabled, enclosing: disabled),
  );
}