FSelectSectionStyle.inherit constructor

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

Creates a FSelectSectionStyle that inherits its properties.

Implementation

factory FSelectSectionStyle.inherit({
  required FColors colors,
  required FStyle style,
  required FTypography typography,
}) {
  const padding = EdgeInsetsDirectional.only(start: 11, top: 7.5, bottom: 7.5, end: 6);
  final iconStyle = FVariants<FTappableVariantConstraint, FTappableVariant, IconThemeData, IconThemeDataDelta>.from(
    IconThemeData(color: colors.foreground, size: 15),
    variants: {
      [.disabled]: .delta(color: colors.disable(colors.foreground)),
    },
  );
  final textStyle = FVariants<FTappableVariantConstraint, FTappableVariant, TextStyle, TextStyleDelta>.from(
    typography.sm.copyWith(color: colors.foreground),
    variants: {
      [.disabled]: .delta(color: colors.disable(colors.foreground)),
    },
  );

  return .new(
    labelTextStyle: FVariants.from(
      typography.sm.copyWith(color: colors.foreground, fontWeight: .w600),
      variants: {
        [.disabled]: .delta(color: colors.disable(colors.foreground)),
      },
    ),
    dividerColor: .all(colors.border),
    dividerWidth: style.borderWidth,
    itemStyle: FItemStyle(
      backgroundColor: const .all(null),
      decoration: FVariants.from(
        const BoxDecoration(),
        variants: {
          [.focused, .hovered, .pressed]: .delta(color: colors.secondary, borderRadius: style.borderRadius),
          //
          [.disabled]: const .delta(),
        },
      ),
      contentStyle:
          .inherit(
            colors: colors,
            typography: typography,
            prefix: colors.foreground,
            foreground: colors.foreground,
            mutedForeground: colors.mutedForeground,
          ).copyWith(
            padding: padding,
            prefixIconStyle: iconStyle,
            prefixIconSpacing: 10,
            titleTextStyle: textStyle,
            titleSpacing: 4,
            suffixIconStyle: iconStyle,
          ),
      rawItemContentStyle: FRawItemContentStyle(
        padding: padding,
        prefixIconStyle: iconStyle,
        childTextStyle: textStyle,
      ),
      tappableStyle: style.tappableStyle.copyWith(motion: FTappableMotion.none),
      focusedOutlineStyle: null,
    ),
  );
}