I have a RichText
widget that contains some TextSpan
. Around a TextSpan
widget I want to place a border around it.
RichText(
text: TextSpan(
style: textStyle,
children: [ ], // code has more TextSpan widgets as children
),
This is an example of the effect I am trying to achieve in Flutter.
Paint paint = Paint()
..color = Colors.blue
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeWidth = 2.0;
RichText(
text: TextSpan(children: [
TextSpan(text: '123'),
TextSpan(text: '456', style: TextStyle(background: paint)),
TextSpan(text: '789')
]))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With