【问题标题】:Show icons bigger [Flutter] [duplicate]显示更大的图标 [Flutter] [重复]
【发布时间】:2020-11-22 22:29:34
【问题描述】:

我想在不增加小部件总大小的情况下显示更大的图标,可能只显示图标的一部分。

我该怎么做?

【问题讨论】:

标签: flutter


【解决方案1】:

How to resizing an Icon / Icon Button in Flutter? 中的答案 帮助了我。

我已使用Transform.scale 对其进行缩放。

return FittedBox(
  child: FlatButton(
    color: Colors.red,
    onPressed: () {},
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(45),
    ),
    child: Row(
      children: [
        Transform.scale(
          child: Icon(LetsGoIcons.fighting, color: Colors.white),
          scale: 2,
        ),
        SizedBox(width: 10),
        Text("Fighting",
            style: TextStyle(
                fontWeight: FontWeight.bold,
                color: Colors.white,
                letterSpacing: 0.7,
                fontSize: 18))
      ],
    ),
  )
);

This is how it looks like

【讨论】:

    【解决方案2】:

    只需设置 size 属性即可增大尺寸

    Icon(Icons.clear, size: 18.0)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-21
      • 2021-11-23
      • 1970-01-01
      • 2022-01-18
      • 2021-04-17
      • 2019-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多