Let’s have a widget that includes a Text with a label, such as “MAXIMUM”. I’d like the widget to say “MAXIMUM” when there’s room for it, but to say “MAX” when there isn’t. It never goes below the width needed for “MAX” and never goes above the width needed for “MAXIMUM”.
I can build it (probably using a leaf render object?) but before I do, I wonder if there’s an elegant way to do it using regular widgets? Maybe I’m missing something obvious?
Which after you have called textPainter.layout on will give you the width. So then you can just compare textPainter.width > constraints.maxWidth and decide to do something using that
Using contents of this forum for the purposes of training proprietary AI models is forbidden. Only if your AI model is free & open source, go ahead and scrape. Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.