FCalendarStyle.inherit constructor

FCalendarStyle.inherit({
  1. required FColors colors,
  2. required FTypography typography,
  3. required FStyle style,
  4. required bool touch,
})

Creates a FCalendarStyle that inherits its properties.

Implementation

factory FCalendarStyle.inherit({
  required FColors colors,
  required FTypography typography,
  required FStyle style,
  required bool touch,
}) {
  final borderRadius = style.borderRadius.md;
  return FCalendarStyle(
    headerStyle: .inherit(colors: colors, typography: typography, style: style, touch: touch),
    dayPickerStyle: .inherit(colors: colors, typography: typography, style: style, touch: touch),
    yearMonthPickerStyle: FCalendarEntryStyle(
      backgroundColor: FVariants(
        colors.card,
        variants: {
          [.hovered, .pressed]: colors.secondary,
          //
          [.disabled]: colors.card,
        },
      ),
      borderSide: FVariants<FTappableVariantConstraint, FTappableVariant, BorderSide?, Delta>(
        null,
        variants: {
          [.focused]: BorderSide(color: colors.foreground, width: style.borderWidth),
          //
          [.disabled]: null,
        },
      ),
      textStyle: FVariants.from(
        typography.sm.copyWith(color: colors.foreground, fontWeight: .w500),
        variants: {
          [.disabled]: .delta(color: colors.disable(colors.foreground)),
        },
      ),
      borderRadius: borderRadius,
    ),
    decoration: ShapeDecoration(
      shape: RoundedSuperellipseBorder(
        side: BorderSide(color: colors.border, width: style.borderWidth),
        borderRadius: borderRadius,
      ),
      color: colors.card,
    ),
  );
}