I am implementing something like a breadcrumbs trail of hot (tap-able) text separated by separator characters and I want the whole thing to wrap as needed in the middle of the hot text if the need to wrap falls there. Because the crumbs are links, they have to be a collection of widgets, but displaying them in a Wrap object causes them to wrap on a per-widget basis and therefore never in the middle of the crumb links.
I tried to do this using Row, rows of Rows with the last one expanded, trying properties like softWrap on Text objects, "rich text," and more. I looked around for this use case, and posted to another forum. Seems like this should be possible in a mature app development framework.
2
Answers
You can use
Text.rich()
for inline widget/text case. With rich text we can use inline widget with text without any linebreak.I provide simple code to show how
Text.rich()
works:The Output
If you try my demonstration code, if you click the text, it’ll be show a log ‘clicked: $crumbText’
Reference:
After a quick research, it turns out that
TextSpan
has a property that provides gesture recognizer inrecognizer
. This recognizer can be filled with many gesture recognizer such asTapGestureRecognizer
that has similar ability withonTap
inGestureDetector
.I provide example code of how this works:
The Output
Reference: