Want to add border around TextSpan in RichText widget? Use the below example code to add border around TextSpan in RichText widget in your flutter application.
1 2 3 4 5 6 7 8 9 10 11 12 |
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 like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.