FSidebarItemStyle.inherit constructor

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

Creates a FSidebarItemStyle that inherits its properties.

Implementation

factory FSidebarItemStyle.inherit({
  required FColors colors,
  required FTypography typography,
  required FStyle style,
  required bool touch,
}) {
  EdgeInsetsGeometry padding;
  if (touch) {
    padding = const .symmetric(horizontal: 12, vertical: 14);
  } else {
    padding = const .all(8);
  }

  return FSidebarItemStyle(
    textStyle: .from(
      typography.sm.copyWith(color: colors.foreground, overflow: .ellipsis, height: 1),
      variants: {
        [.disabled]: .delta(color: colors.mutedForeground),
      },
    ),
    iconStyle: .from(
      IconThemeData(color: colors.foreground, size: 16),
      variants: {
        [.disabled]: .delta(color: colors.mutedForeground),
      },
    ),
    collapsibleIconStyle: .from(
      IconThemeData(color: colors.foreground, size: 16),
      variants: {
        [.disabled]: .delta(color: colors.mutedForeground),
      },
    ),
    backgroundColor: FVariants(
      colors.background,
      variants: {
        [.selected, .hovered, .pressed]: colors.secondary,
        //
        [.disabled]: colors.background,
      },
    ),
    padding: padding,
    borderRadius: style.borderRadius.md,
    tappableStyle: style.tappableStyle.copyWith(motion: FTappableMotion.none),
    focusedOutlineStyle: style.focusedOutlineStyle.copyWith(spacing: 0),
  );
}