Sun*_*ine 6 flutter flutter-layout
我有一个RichText()带有 TextSpan 的小部件,其中包含一串符号,例如\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac
即使没有空格,这组符号也不被视为一个单词
\n-> 我想避免这些符号之间发生换行,这些符号必须保持在一起
\n我无法设置,softWrap: false因为RichText我需要在某处换行以避免溢出
RichText(\n text: TextSpan(\n text: \'Random text hello there Random long text\',\n children: <TextSpan> [\n const TextSpan(text: \' \xc2\xb7 \'),\n TextSpan(text: \'\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\'),\n ],\n ),\n ),\nRun Code Online (Sandbox Code Playgroud)\n我不能softWrap: false直接在 TextSpan 或类似的东西上设置吗?
使用WidgetSpanwithText代替TextSpan.
RichText(\n text: TextSpan(\n text: \'Random text hello there Random\',\n children: [\n const TextSpan(text: \' \xc2\xb7 \'),\n WidgetSpan(\n child: Text(\'\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac\'),\n ),\n ],\n ),\n)\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
753 次 |
| 最近记录: |