flutter组件之Icon

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",//长按后的提示语
	),
  ],
)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值