flutter - 如何正确填充具有点击效果的 IconButton?
问题描述
我是新来的。我尝试演示应用程序。我需要 appBar 上的 IconButton 并创建它。但是我将填充设置为 IconButton 并且图标位置发生了变化,但是单击波浪效果没有随 iconButton 改变。
我想正确地将填充设置为 IconButton。
这是我的 appBar :
appBar: new AppBar(
title: new Text('Demo App'),
actions: <Widget>[
IconButton(
icon: new Icon(Icons.dehaze, size:45.0, ),
padding: const EdgeInsets.only(right: 40.0),
alignment: Alignment.center,
tooltip: 'Air it',
onPressed: (){},
),
],
),
解决方案
在小部件中设置您的图标大小,IconButton
而不是Icon
. 这样 IconButton 将识别调整大小的图标并为您施展魔法。
IconButton(
iconSize: 45,
icon: new Icon(Icons.dehaze),
tooltip: 'Air it',
onPressed: (){},
),
推荐阅读
- c# - 我无法将 VS-2017 应用程序(Android 和 IOS)部署到 iphone
- cplex - 解释 OPL 的解决方案文件
- sorting - 计算算法时间复杂度的方法
- python - 如何在 doc2vec 模型中使用预训练的 word2vec 向量?
- paypal - 如何从付款 ID 中找到交易 ID?
- spring - 无法创建请求的服务 [org.hibernate.engine.spi.CacheImplementor]
- agora.io - 如何使用 web sdk 在 agora 中获取多个直播流作为观众?
- c# - c# 根据条件从 IReadOnlyCollection 中获取 N 个结果
- javascript - 使用 multer 在 url 中有 %20
- powerpoint - 在 Powerpoint 幻灯片中插入形状(Office Javascript API)