RichText的textSpan周围的边框

问题描述 投票:0回答:1

我有一个RichText小部件,其中在TextSpan.小部件周围包含一些TextSpan,我想在其周围放置边框。另外,我希望它可以在网络上运行,但是目前从我的方法来看,这仅适用于移动设备。

预期:我要实现以下目标。<code>enter image description here</code>

使用此代码的结果:

    Paint paint = Paint()
  ..color = Colors.blue
  ..style = PaintingStyle.stroke
  ..strokeCap = StrokeCap.round
  ..strokeWidth = 2.0;

RichText(
   text: TextSpan(children: [
       TextSpan(text: text1),
       TextSpan(text: text2, style: TextStyle(background: paint)),
       TextSpan(text: text3, )
  ]))

请帮助!

如果不清楚,简单来说,我只是想在突出显示的部分周围有一个边框,并在下图中删除突出显示的部分,而无需进行其他任何更改

enter image description here

flutter flutter-layout flutter-dependencies flutter-web
1个回答
0
投票
return Container( margin: const EdgeInsets.all(30.0), padding: const EdgeInsets.all(10.0), decoration: BoxDecoration( border: Border.all(), ), child: Text( "text", style: TextStyle(fontSize: 30.0), ), );
© www.soinside.com 2019 - 2024. All rights reserved.