Reputation: 177
I am trying to draw *star in label as the image below
I have tried
Text("5 *",style: TextStyle(color: Colors.white, backgroundColor: Colors.green),)
But I don't know how I can embed *(Star) with label ?
Upvotes: 1
Views: 2574
Reputation: 3767
Just check this code :
The star icon can be obtained using this plugin:
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,),
],
),
),
Upvotes: 1
Reputation: 3073
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)
])),
Upvotes: 2
Reputation: 2799
you can use the icon class for that
Row(
children: [
Text("5),
Icon(Icons.star),
]
)
Upvotes: 3