如何拉伸图标来填充父级?

Pau*_*aul 6 flutter

我需要一个动态拉伸以填充父容器的图标.

我认为这不可能直接在Icon上(因为它只有一个大小属性),但还有另一个我忽略的解决方案吗?

use*_*442 12

我相信你可以使用FittedBoxExpanded:

new Expanded(
    child: new FittedBox(
      fit: BoxFit.fill,
      child: new Icon(Icons.home),
    ),
),
Run Code Online (Sandbox Code Playgroud)

请注意,该文档Expanded已被包裹在一个Column,RowFlex小部件.

参考文献: