Skip to content

Modifier and indication API

Declared by <huxerui/modifier.h> and <huxerui/indication.h>.

ViewModifier accepts built-in property modifiers and retained modifier values whose nested extension derives from NodeExtension. View::With applies modifiers left to right. Descriptor and erased storage types live in huxerui::detail; custom retained behavior uses the typed modifier and NodeExtension contract instead of depending on that storage.

  • Enabled{value} and Focusable{value}.
  • Padding(float|EdgeInsets).
  • Background{VisualFill}, Foreground{Color}, Border{color, width}, Shadow{color, offset, blur_radius, spread}.
  • FontSize{value}.
  • Frame{width, height, min_width, max_width, min_height, max_height}.
  • CornerRadius{CornerRadii} and marker ClipChildren.
  • Spacing{value}, MainAlign{MainAxisAlignment}, CrossAlign{CrossAxisAlignment}, and Align{HorizontalAlignment, VerticalAlignment}.
  • Grow{factor}.
  • ScrollPhysics{fling_enabled, deceleration_rate, minimum_fling_velocity, maximum_fling_velocity}.
  • ScrollBar{optional<ScrollBarStyle>}; style fields cover geometry, fade timing, track, and thumb.

Retained per-node behavior. Override only needed hooks for update, mount/unmount, interaction, frame advance, paint phases, text input/selection clients, semantics, semantic actions, focus traversal, and cancel handling. InvalidatePaint() marks its node paint dirty. FrameInfo supplies time and delta; returned FrameResult controls further scheduling.

  • IndicationPlacement: BehindContent or AboveContent.
  • IndicationLayer: optional fill, border, corner radii, placement, enter spec, and exit spec.
  • RippleEffect: color, placement, expansion, and fade-out specs.
  • IndicationGeometry: optional layer size and clip radii.
  • Indication: retained modifier with focus, hover, press, ripple, and geometry.
  • FocusRing: color, width, and offset.

VisualFill comes from the paint API and supports colors, gradients, and images.

Property modifiers apply from left to right to one view declaration and do not create wrapper nodes. Retained modifiers reconcile by descriptor and declaration position; a compatible NodeExtension receives updated declarative data while preserving retained state. Moving or conditionally inserting retained modifiers can therefore replace an extension just as changing an unkeyed child position can replace a child.

Background paints behind node content, Foreground changes the content foreground color, and indication layers choose behind- or above-content placement. FocusRing is a style value used by themes and controls, not a standalone ViewModifier. NodeExtension is an extension API; application components normally prefer property modifiers, typed events, Lifecycle, and built-in indication.