我有一个RichText
小部件,其中在TextSpan.
小部件周围包含一些TextSpan
,我想在其周围放置边框。另外,我希望它可以在网络上运行,但是目前从我的方法来看,这仅适用于移动设备。
使用此代码的结果:
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, )
]))
请帮助!
如果不清楚,简单来说,我只是想在突出显示的部分周围有一个边框,并在下图中删除突出显示的部分,而无需进行其他任何更改
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),
),
);