Expand description
Default ToggleStyle impl driven by paint-recipe data.
RecipeToggleStyle ships the IntUI look out of the box; apps that
want a different design language (Material 3 switch, neumorphic
toggle, Cupertino) write their own impl ToggleStyle block and
install it per-call (Toggle::style(...)) or theme-wide
(theme.style_slots.toggle = Some(Rc::new(MyToggle))).
The visual body is a tiny custom leaf widget (ToggleBody) that
paints track + knob on the canvas. We could compose
RectWidget(track) | Position(knob_x, RectWidget(knob)) instead,
but no general-purpose absolute-positioning primitive exists today
and the compositional version isn’t free either — it adds one
layout pass and two arena nodes per Toggle. The leaf body keeps
parity with the paint-cost of the pre-refactor Toggle. Custom
ToggleStyle impls are free to compose if they prefer.
Structs§
- Recipe
Toggle Style - Default
ToggleStyleshipped with Teksilo. Reads its dimensions from aToggleRecipe(defaulting to the IntUITOGGLE_*constants) and its colors fromtheme.colors.{accent, surface_sunken, ...}. - Toggle
Recipe - Tunable dimensions for
RecipeToggleStyle.Defaultyields the IntUITOGGLE_*constants; a theme can override individual fields.