FItemStyle.inherit constructor

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

Creates a FTileGroupStyle that inherits from the given arguments.

Implementation

factory FItemStyle.inherit({
  required FColors colors,
  required FTypography typography,
  required FStyle style,
  required bool touch,
}) {
  final (:suffixedPadding, :unsuffixedPadding, :margin) = FItemStyle.menuInsets(touch: touch);
  return FItemStyle(
    backgroundColor: FVariants(
      colors.background,
      variants: {
        [.disabled]: colors.background,
      },
    ),
    decoration: .from(
      ShapeDecoration(
        shape: RoundedSuperellipseBorder(borderRadius: style.borderRadius.md),
        color: colors.background,
      ),
      variants: {
        [.hovered, .pressed]: .shapeDelta(color: colors.secondary),
        //
        [.disabled]: const .shapeDelta(),
        //
        [.selected]: .shapeDelta(color: colors.secondary),
        [.selected.and(.disabled)]: .shapeDelta(color: colors.disable(colors.secondary)),
      },
    ),
    contentStyle: .inherit(
      colors: colors,
      typography: typography,
      prefix: colors.primary,
      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,
      pressedEnterDuration: .zero,
      pressedExitDuration: const Duration(milliseconds: 25),
    ),
    focusedOutlineStyle: style.focusedOutlineStyle,
    margin: margin,
  );
}