I have 2 questions.
how to scale our icon ? I mean not a default icon from Flutter. but when you change into an Image. I have an Icon Button with an image like this:
Row(
mainAxisSize: MainAxisSize.max,
children: [
IconButton(
icon: new Image.asset("images/IG.png"),
),
IconButton(
icon: new Image.asset("images/Twitter.png"),
),
IconButton(
icon: new Image.asset("images/Fb.png"),
),
],
)
its only 3 icons. when I add more icon, its gonna break the layout into bricks yellow-black. how to make them become smaller ?
Question above is for IconButton.
how to change an Icon with an Image ?
here are the code:
Icon(Icons.star, color: Colors.red)
how to change the 'star' with Image.asset ?
without any referal to other link, that only show the icon.
解决方案
You can use size property for Icon.
Icon(
Icons.radio_button_checked,
size: 12,
),
And for IconButton you can use
Transform.scale(
scale: 0.5,
child: IconButton(
onPressed: (){},
icon: new Image.asset("images/IG.png"),
),
),