container, text, date_picker: width-aware sizing pass
`Container::max_width(px)` mirrors the same flag on `Column` / `Row` — the container reports `min( offered, px )` upwards and the draw pass caps `rect.width` to `px`, so a decorated child wrapped in `container().max_width(260)` no longer needs a `column()`-of-one shell just to access the cap. Propagated through `map_msg`, covered by a test, and documented under the `container` section of `docs/widgets.md`.
`Text::no_truncate()` opts out of the default ellipsis behaviour: when `truncate = false` the draw pass paints the full string even if `measure(text) > rect.width`. Useful for very short labels (calendar days "1"–"31", day-of-week stubs "Lu" / "Mi" / "Sá") inside grid slots whose width is dictated by the parent — a couple of pixels of overflow centred in the rect is invisible, while "..." in place of a single-digit number is loud.
`DatePicker::width(px)` is a layout hint: when set, `build()` derives `header_fs`, `dow_fs` and `day_fs` from the slot width so the worst-case label in each row ("September 2026" in the header, "Mié" / "Sáb" in the DOW row, "30" in the day cell) fits at a sensible size; the design defaults stay as upper bounds. Day and DOW cells also flip on `Text::no_truncate()` as a safety net — heuristic font sizing can't perfectly predict glyph widths across families, and overflowing one pixel beats truncating to "...".
This commit is contained in:
@@ -384,6 +384,12 @@ Per-edge padding is available with `padding_top` / `padding_right` /
|
||||
`padding_bottom` / `padding_left`. Per-corner radius takes a [`Corners`]
|
||||
struct or a tuple.
|
||||
|
||||
`max_width(px)` caps the container's outer width — when the parent
|
||||
offers a wider rect, the container reports `min( offered, px )` as its
|
||||
preferred width instead of stretching to fill. Mirrors the same flag on
|
||||
[`column`](#column) and [`row`](#row), so a single decorated child no
|
||||
longer needs a `column`-of-one wrap just to access a width cap.
|
||||
|
||||
**See also**: [`pressable`](#pressable) wrapping a `container` makes a
|
||||
card interactive.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user