flutter显示图标_如何自动调整Flutter中的图标大小
目前,我正在使用以下代码:body: new Container(child: new Column(crossAxisAlignment: CrossAxisAlignment.stretch,mainAxisAlignment: MainAxisAlignment.spaceEvenly,children: [new MaterialButton(height: 120.0,child: ne
目前,我正在使用以下代码:
body: new Container(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
new MaterialButton(
height: 120.0,
child: new Column(
children: [
new Icon(
Icons.av_timer,
size: 100.0,
),
new Text('TIMER'),
],
),
onPressed: null,
),
new MaterialButton(
height: 120.0,
child: new Column(
children: [
new Icon(Icons.alarm_add, size: 100.0),
new Text('ALARM'),
],
),
onPressed: null,
)
])));
但是,我不得不将Icon大小“硬编码”为100.0,将MaterialButton的高度“硬编码”为120.0.
我希望MaterialButton占用尽可能多的空间(每个屏幕占50%),我希望这些图标能够“很好地适应”该空间,理想情况下还有文本缩放.
我还没有找到在Flutter中做到这一点的方法.如果尝试这样做不是一个好主意(我希望在任何设备上使用屏幕的整个空间),请告诉我原因?
更多推荐
所有评论(0)