我正尝试在标签中绘制 * star 作为下图
我尝试过
Text("5 *",style: TextStyle(color: Colors.white, backgroundColor: Colors.green),)
但是我不知道如何在标签上嵌入 *(星号)?
答案 0 :(得分:2)
您可以为此使用图标类
Row(
children: [
Text("5),
Icon(Icons.star),
]
)
答案 1 :(得分:2)
Container(
width: 80,
height:50,
padding: EdgeInsets.all(10),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.green[700],
),
child: Row(
mainAxisAlignment:MainAxisAlignment.center,
children: [
Text('5',
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
)),
SizedBox(width: 10),
Icon(Icons.star, color: Colors.white)
])),
答案 2 :(得分:1)
只需检查以下代码:
可以使用此插件获取星标:
https://pub.dev/packages/material_design_icons_flutter#-readme-tab-
Container(
decoration: BoxDecoration(borderRadius: BorderRadius.circular(10.0),color: Colors.green),
width: 100,
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Text('5',style: TextStyle(color: Colors.white),),
),
Icon(MdiIcons.star,color: Colors.white,),
],
),
),