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 = FWidgetStateMap({
    WidgetState.disabled: IconThemeData(color: colors.disable(colors.primary), size: 15),
    WidgetState.any: IconThemeData(color: colors.primary, size: 15),
  });
  final textStyle = FWidgetStateMap({
    WidgetState.disabled: typography.sm.copyWith(color: colors.disable(colors.primary)),
    WidgetState.any: typography.sm.copyWith(color: colors.primary),
  });

  return FSelectSectionStyle(
    labelTextStyle: FWidgetStateMap({
      WidgetState.disabled: typography.sm.copyWith(
        color: colors.disable(colors.primary),
        fontWeight: FontWeight.w600,
      ),
      WidgetState.any: typography.sm.copyWith(color: colors.primary, fontWeight: FontWeight.w600),
    }),
    dividerColor: FWidgetStateMap.all(colors.border),
    dividerWidth: style.borderWidth,
    itemStyle: FItemStyle(
      backgroundColor: FWidgetStateMap.all(null),
      decoration: FWidgetStateMap({
        ~WidgetState.disabled & (WidgetState.focused | WidgetState.hovered | WidgetState.pressed): BoxDecoration(
          color: colors.secondary,
          borderRadius: style.borderRadius,
        ),
      }),
      contentStyle: FItemContentStyle.inherit(colors: colors, typography: typography).copyWith(
        padding: padding,
        prefixIconStyle: iconStyle,
        prefixIconSpacing: 10,
        titleTextStyle: textStyle,
        titleSpacing: 4,
        subtitleTextStyle: FWidgetStateMap({
          WidgetState.disabled: typography.xs.copyWith(color: colors.disable(colors.mutedForeground)),
          WidgetState.any: typography.xs.copyWith(color: colors.mutedForeground),
        }),
        suffixIconStyle: FWidgetStateMap({
          WidgetState.disabled: IconThemeData(color: colors.disable(colors.primary), size: 15),
          WidgetState.any: IconThemeData(color: colors.primary, size: 15),
        }),
      ),
      rawItemContentStyle: FRawItemContentStyle(
        padding: padding,
        prefixIconStyle: iconStyle,
        childTextStyle: textStyle,
      ),
      tappableStyle: style.tappableStyle.copyWith(bounceTween: FTappableStyle.noBounceTween),
      focusedOutlineStyle: null,
    ),
  );
}