我希望在Flutter中设置Textspan的圆角,我认为需要使用Paint类,但我不知道如何实现。
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: new AppBar(),
body: new RichText(
text: new TextSpan(
text: null,
style: TextStyle(fontSize: 20.0, color: Colors.black),
children: <TextSpan>[
new TextSpan(
text: 'inactive ',),
new TextSpan(
text: 'active',
style: new TextStyle(
color: Colors.white,
background: Paint()
..color = Colors.redAccent,
)),
],
),
),
),
);
}
}
有没有一种使用Textspan来实现这个而不是使用包装文本的Container的方法?