Pri*_*nca 2 text background dart flutter
我有一个文本,它基本上是一个框中的标题,我想为该文本后面的空间提供背景颜色。
Padding(
padding: EdgeInsets.all(15.0),
child: Text(
'Your Profile',
style: TextStyle(
color: Colors.blue,
fontSize: 26.0,
background: Paint()..color = Colors.blue,
),
Run Code Online (Sandbox Code Playgroud)
这是我尝试过的,但似乎不起作用。
预期:此处“您的个人资料”文本具有背景颜色,我需要实现这一点。
你可以用一个Container()但是,很可能你必须用类似的东西定义宽度 double.maxFinite
检查这个
Container(
width: double.maxFinite,
color: Colors.red, //define the background color
child: Text("My Text"),
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4343 次 |
| 最近记录: |