在可选择的文本块中,是否可以添加操作按钮(或者更准确地说,是操作图标)?
我实际上使用的是SelectableText.rich和TextSpan小部件。但他们不允许添加按钮或TextSpan以外的任何其他按钮。
我还想避免使用多个SelectableText.rich,并将我的按钮放在它们之间,因为这会破坏“全选”功能。
发布于 2021-05-14 07:35:30
看起来你不能用一个SelectableText做到这一点。我尝试按照下面的代码片段使用WidgetSpan,但得到了以下错误。
const SelectableText.rich(
TextSpan(children: [
TextSpan(text: "Some text"),
WidgetSpan(child: Icon(Icons.face)),
TextSpan(text: "Some more text"),
])
)

相比之下,如果我们用Text替换SelectableText,我们会得到:

https://stackoverflow.com/questions/67526426
复制相似问题