flutter - 如何包含带有子图像的 FlatButton UI?
问题描述
我想让我的图像像容器 FlatButton 的大小
这是我的代码
child: FlatButton(
child: canRoll
? Image.asset( '/images/wRoll.png', fit: BoxFit.contain,)
: Image.asset('/images/wNoRoll.png',fit: BoxFit.contain,),
有没有办法让我的图像尺寸更大?或响应我的 FlatButton?
解决方案
你可以试试这段代码:
Container(child: ConstrainedBox(
constraints: BoxConstraints.expand(),
child: FlatButton(
onPressed: null,
padding: EdgeInsets.all(0.0),
child: canRoll ? Image.asset('images/wRoll.png')
: Image.asset('images/wNoRoll.png')
) //FlatButton
) //ConstrainedBox
) //Container
将填充设置为零应该会有所帮助。
推荐阅读
- string - 如何在 Scala 中使用字符串值匹配?
- javascript - 如何在单击时创建一个按钮以将 JSON 解析为 javascript 并制作表格?
- django - 从 gitlab 下载 django 项目时出现 pyodbc 会话错误
- ios - 如何使用 FCM 在 ios 推送通知中播放自定义通知声音
- python - Ansible 单元素列表中断了查找调用
- gis - 即使有填充,OpenLayers 文本标签也会重叠
- php - Golang 相当于 php 中的 openssl_public_decrypt
- angular - Uncaught TypeError: Object(...) is not a function 使用 Angular Google 地图时
- c++ - 出现错误:尝试加载 .ogg 文件时出现“对 `__imp__ZN2sf5 的未定义引用”
- javascript - 在文本区域内添加 ajaxresponse