Alexander Maryanovsky
05/11/2024, 11:28 AMText
that shows a value that changes while it is displayed - sometimes it’s is short, other times long, and the longest value that can be displayed is known.
The Text
is part of a Row
where another element has weight(1f)
. I would like to have this Text
measured with the longest value, so that the layout doesn’t change when the value changes. Is there a clean (no hacks like adding a transparent Text
with the longest value) way to do this?Stylianos Gakis
05/11/2024, 1:15 PMAlexander Maryanovsky
05/11/2024, 1:17 PMStylianos Gakis
05/11/2024, 1:20 PMStylianos Gakis
05/11/2024, 1:21 PMAlexander Maryanovsky
05/11/2024, 1:22 PMText
, which I imagine can cause all sorts of problems. Some off the top of my head:
1. Screen readers will read both texts. Can be worked around by providing a custom semantics on the other text.
2. If you place this in a SelectionContainer
, god knows what you will end up copying.Alexander Maryanovsky
05/11/2024, 1:22 PMAlexander Maryanovsky
05/11/2024, 1:24 PMAlexander Maryanovsky
05/11/2024, 1:24 PMStylianos Gakis
05/11/2024, 1:25 PMlayout(width = width, height = height) {}
since nothing is placed at all, is that not the case?Alexander Maryanovsky
05/11/2024, 1:25 PMStylianos Gakis
05/11/2024, 1:27 PM.withoutPlacement()
which imo is the best of both worlds.Alexander Maryanovsky
05/11/2024, 1:27 PMStylianos Gakis
05/11/2024, 1:27 PMAlexander Maryanovsky
05/11/2024, 1:28 PMZach Klippenstein (he/him) [MOD]
05/11/2024, 9:40 PMAlexander Maryanovsky
05/11/2024, 9:42 PMAlexander Maryanovsky
05/11/2024, 9:43 PMZach Klippenstein (he/him) [MOD]
05/11/2024, 9:57 PMZach Klippenstein (he/him) [MOD]
05/11/2024, 9:59 PMAlexander Maryanovsky
05/11/2024, 10:24 PMText(
text: String,
measuredText: String = text
...
)
Zach Klippenstein (he/him) [MOD]
05/13/2024, 2:46 PM