pattern_grid: explicit side through PatternGrid::size
CI / build + test (push) Has been cancelled
CI / cargo audit (push) Has been cancelled

The grid's preferred size was the theme's fluid constant (264 px at the reference surface) capped by the width the parent allocates, so a caller could only shrink it: a lock screen that wants the grid to span most of a phone's width had no way to ask for it, and a container's max_width did nothing past the default. PatternGrid gains a size field with a size( impl Into<Length> ) builder; preferred_size resolves it through Canvas::resolve_geom like the other geometry overrides and still caps it at max_width, and map_msg carries it across. Without the builder the fluid default applies as before.
docs/widgets.md describes the builder next to hide_stroke and error; CHANGELOG lists it under Unreleased.
This commit is contained in:
2026-09-10 21:33:55 +02:00
parent 7c1ef86afe
commit c9ae5438f8
3 changed files with 20 additions and 3 deletions
+2
View File
@@ -368,6 +368,8 @@ repeat, or taking in the node a straight stroke crosses is the app's
rule, not the widget's. `on_release( msg )` fires when the finger lifts.
`hide_stroke( true )` draws only the dots, against shoulder surfing;
`error( true )` paints the current path in the palette's `danger` colour.
`size( len )` sets the side of the square grid (any `Length`); without it the
theme's fluid default applies, capped by the width the parent allocates.
It sizes itself square to `min( max_width, 264 )` design pixels; wrap it
in a `container( … ).max_width( … )` to pin it.