FSelectSectionStyle.inherit constructor

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

Creates a FSelectSectionStyle that inherits its properties.

Implementation

factory FSelectSectionStyle.inherit({
  required FColors colors,
  required FStyle style,
  required FTypography typography,
  required bool touch,
}) {
  final (:suffixedPadding, :unsuffixedPadding, :margin) = FItemStyle.selectInsets(touch: touch);
  return .new(
    labelTextStyle: FVariants.from(
      typography.xs.copyWith(color: colors.mutedForeground),
      variants: {
        [.disabled]: .delta(color: colors.disable(colors.mutedForeground)),
      },
    ),
    dividerColor: .all(colors.border),
    dividerWidth: style.borderWidth,
    itemStyle: FItemStyle(
      backgroundColor: const .all(null),
      decoration: .from(
        const ShapeDecoration(shape: RoundedSuperellipseBorder()),
        variants: {
          [.focused, .hovered, .pressed]: .shapeDelta(
            shape: RoundedSuperellipseBorder(borderRadius: style.borderRadius.md),
            color: colors.secondary,
          ),
          //
          [.disabled]: const .shapeDelta(),
        },
      ),
      contentStyle: .inherit(
        colors: colors,
        typography: typography,
        prefix: colors.foreground,
        foreground: colors.foreground,
        mutedForeground: colors.mutedForeground,
        suffixedPadding: suffixedPadding,
        unsuffixedPadding: unsuffixedPadding,
      ),
      rawItemContentStyle: .inherit(
        colors: colors,
        typography: typography,
        prefix: colors.foreground,
        color: colors.foreground,
        padding: unsuffixedPadding,
      ),
      tappableStyle: style.tappableStyle.copyWith(motion: FTappableMotion.none),
      focusedOutlineStyle: null,
      margin: margin,
    ),
  );
}