Icon是图标组件。
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const <Widget>[
Icon(
Icons.favorite,
color: Colors.pink,
size: 24.0,//图标显示的大小,固定是正方形,默认24,
semanticLabel: 'Text to announce in accessibility modes',//提供语言辅助描述,还未用到过
),
Icon(
Icons.audiotrack,
color: Colors.green,//图标颜色,如果不设置,默认是黑色图标
size: 30.0,
textDirection:,//图标显示的方向,是向左还是向右,IconData的matchTextDirection为true时有效,matchTextDirection默认值为false,因此只设置textDirection无效
),
Icon(
Icons.beach_access,
color: Colors.blue,
size: 36.0,
),
//IconData()方式的图标
Icon(
IconData(0xe914, fontFamily: 'MaterialIcons',matchTextDirection: true),
color: Colors.red,
size: 30,
textDirection: TextDirection.rtl
),
//ImageIcon()方式的图标
ImageIcon(
AssetImage("images/img06.png"),
color: Colors.green,
size: 40,
),//绿色
//图标按钮
IconButton(
icon: Icon(
Icons.accessible,
color: Colors.green,
),
iconSize: 24.0,
padding: const EdgeInsets.all(8.0),
alignment: Alignment.center,
color: Colors.red,
onPressed: () {},//点击触发的方法
highlightColor: Colors.green,//长按后不松手时显示的颜色
splashColor: Colors.blue,//点击一下时闪烁的颜色
disabledColor: Colors.grey,//不可用时的颜色
tooltip: "sss",//长按后的提示语
),
],
)