Let the people panel keep the width it asked for
A row child that fills the column is given Expanded, so that the message list is the width of the row rather than of its longest URL. The panel beside it qualified too — the wrapper it sits in comes and goes, and the question recurses through it — and Expanded hands out a tight width, which beats the SizedBox underneath. The panel asked for 150, got its share of the row, and every nick in it ellipsised to fit. So the rule now asks first whether the child has already said how wide it is. Nothing is lost by leaving such a child alone: the row stretches its children when one of them fills the column, which is where the height a fill-height pane needs comes from. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
3fb7fd0 parent: 6ab08e7 modified
flutter/src/frq/hiccup.cljd +25 -1 | @@ -353,6 +353,25 @@ | ||
| 353 | 353 | (and (contains? #{:vbox :card :hbox} tag) |
| 354 | 354 | (boolean (some #(fills-column? (expand %)) (body node)))))))) |
| 355 | 355 | |
| 356 | +(defn- asks-width? | |
| 357 | + "Whether a node has already said how wide it is. | |
| 358 | + | |
| 359 | + Asked of a row's children, and recursive through plain boxes for the reason | |
| 360 | + `fills-column?` is: the people panel is the width request and the wrapper | |
| 361 | + that comes and goes around it is what the row actually holds. | |
| 362 | + | |
| 363 | + It exists to keep `Expanded` off such a child. Expanded hands out a *tight* | |
| 364 | + width — the child's share of the row — and a tight width beats the SizedBox | |
| 365 | + underneath it, so the panel that asked for 150 got whatever was going and | |
| 366 | + every nick in it ellipsised to fit." | |
| 367 | + [node] | |
| 368 | + (and (vector? node) | |
| 369 | + (let [tag (first node) | |
| 370 | + p (second node)] | |
| 371 | + (or (and (map? p) (some? (width-of p))) | |
| 372 | + (and (contains? #{:vbox :card} tag) | |
| 373 | + (boolean (some #(asks-width? (expand %)) (body node)))))))) | |
| 374 | + | |
| 356 | 375 | (defn- children |
| 357 | 376 | "Flatten seqs, drop nils. `(for [...] ...)` in a component yields a seq in |
| 358 | 377 | the child position and glimmer splices it; so does this." |
| @@ -382,7 +401,12 @@ | ||
| 382 | 401 | ;; and left to its natural width it is as wide as its |
| 383 | 402 | ;; longest line — which is one URL and a screen and a half |
| 384 | 403 | ;; of overflow. |
| 385 | - (and (identical? fills? fills-row?) (fills-column? n)) | |
| 404 | + ;; Unless it has said how wide it is. The row already | |
| 405 | + ;; stretches its children to the full height when one of | |
| 406 | + ;; them fills the column, so a pane with a width of its own | |
| 407 | + ;; needs nothing from Expanded and loses everything to it. | |
| 408 | + (and (identical? fills? fills-row?) (fills-column? n) | |
| 409 | + (not (asks-width? n))) | |
| 386 | 410 | (conj! acc (m/Expanded .child (render n))) |
| 387 | 411 | (and (identical? fills? fills-row?) (flexes-in-row? n)) |
| 388 | 412 | (conj! acc (m/Flexible .child (render n))) |
| @@ -353,6 +353,25 @@ | |||
| 353 | (and (contains? #{:vbox :card :hbox} tag) | 353 | (and (contains? #{:vbox :card :hbox} tag) |
| 354 | (boolean (some #(fills-column? (expand %)) (body node)))))))) | 354 | (boolean (some #(fills-column? (expand %)) (body node)))))))) |
| 355 | 355 | ||
| 356 | +(defn- asks-width? | ||
| 357 | + "Whether a node has already said how wide it is. | ||
| 358 | + | ||
| 359 | + Asked of a row's children, and recursive through plain boxes for the reason | ||
| 360 | + `fills-column?` is: the people panel is the width request and the wrapper | ||
| 361 | + that comes and goes around it is what the row actually holds. | ||
| 362 | + | ||
| 363 | + It exists to keep `Expanded` off such a child. Expanded hands out a *tight* | ||
| 364 | + width — the child's share of the row — and a tight width beats the SizedBox | ||
| 365 | + underneath it, so the panel that asked for 150 got whatever was going and | ||
| 366 | + every nick in it ellipsised to fit." | ||
| 367 | + [node] | ||
| 368 | + (and (vector? node) | ||
| 369 | + (let [tag (first node) | ||
| 370 | + p (second node)] | ||
| 371 | + (or (and (map? p) (some? (width-of p))) | ||
| 372 | + (and (contains? #{:vbox :card} tag) | ||
| 373 | + (boolean (some #(asks-width? (expand %)) (body node)))))))) | ||
| 374 | + | ||
| 356 | (defn- children | 375 | (defn- children |
| 357 | "Flatten seqs, drop nils. `(for [...] ...)` in a component yields a seq in | 376 | "Flatten seqs, drop nils. `(for [...] ...)` in a component yields a seq in |
| 358 | the child position and glimmer splices it; so does this." | 377 | the child position and glimmer splices it; so does this." |
| @@ -382,7 +401,12 @@ | |||
| 382 | ;; and left to its natural width it is as wide as its | 401 | ;; and left to its natural width it is as wide as its |
| 383 | ;; longest line — which is one URL and a screen and a half | 402 | ;; longest line — which is one URL and a screen and a half |
| 384 | ;; of overflow. | 403 | ;; of overflow. |
| 385 | - (and (identical? fills? fills-row?) (fills-column? n)) | 404 | + ;; Unless it has said how wide it is. The row already |
| 405 | + ;; stretches its children to the full height when one of | ||
| 406 | + ;; them fills the column, so a pane with a width of its own | ||
| 407 | + ;; needs nothing from Expanded and loses everything to it. | ||
| 408 | + (and (identical? fills? fills-row?) (fills-column? n) | ||
| 409 | + (not (asks-width? n))) | ||
| 386 | (conj! acc (m/Expanded .child (render n))) | 410 | (conj! acc (m/Expanded .child (render n))) |
| 387 | (and (identical? fills? fills-row?) (flexes-in-row? n)) | 411 | (and (identical? fills? fills-row?) (flexes-in-row? n)) |
| 388 | (conj! acc (m/Flexible .child (render n))) | 412 | (conj! acc (m/Flexible .child (render n))) |