flutter - 如何在颤动中为图标按钮添加标签
问题描述
如何给这个标签IconButton
?
IconButton(
icon: Image.asset('path/the_image.png'),
iconSize: 50,
onPressed: () {},
)
解决方案
使用ListTile
小部件如下:
如果您希望标签成为 ListTile 的标题,请使用此选项:
ListTile(
leading: IconButton( icon: Image.asset('path/the_image.png'), iconSize: 50, onPressed: () {}, ),
trailing: Text('Your label'),
),
或者,如果您希望它是尾随的,请使用:
ListTile(
leading: IconButton( icon: Image.asset('path/the_image.png'), iconSize: 50, onPressed: () {}, ),
title: Text('Your label'),
),
推荐阅读
- azure-resource-manager - ARM 模板 - 映射不同资源组的应用程序洞察力/应用程序服务计划
- dart - 使用 dart2js 构建非最小化项目
- javascript - FullpageJS如何通过动画将目录转到特定部分但不显示中间部分
- dart - 表单被键盘向上推以及如何删除下拉箭头
- r - 拆分具有 2 个相似词的句子
- php - 我想从数据库中选择数据我的代码有什么错误,
- php - 如何通过在 laravel 5.6 中级联来显示下拉列表中的项目?
- c# - 数据库上下文查询 ToDictionary 其中值是实体列表
- javascript - 单击更新按钮时如何更新行
- android - 是否可以根据用户行为获取特定的 Firebase 远程配置设置?