如何将大小设置为 FloatingActionButton - Flutter

How to set size to FloatingActionButton - Flutter

我想让按钮变大。卡片小部件中的按钮,它位于对齐标记中..

Align(
    alignment: Alignment(0.9, 0.9),
    heightFactor: 0.0,
    child: FloatingActionButton(
        onPressed: null,
        child: Icon(Icons.share),
    ),
),

您需要将 FloatingActionButton 包装在 Container 中并使用 size 元素管理 Icon 的大小:

     Align(
        alignment: Alignment.center,
        child: Container(
          width: 100,
          height: 200,
          child: FloatingActionButton(
            onPressed: null,
            child: Icon(
              Icons.share,
              size: 80,
            ),
          ),
        ),
      ),
Align(
   alignment: Alignment(0.9, 0.9),
   heightFactor: 0.0,
   child: Container(
        height: MediaQuery.of(context).size.width * 0.2,
        width: MediaQuery.of(context).size.width * 0.2,
        child: FloatingActionButton(
               onPressed: () {},
               child: Icon(
                 Icons.share,
               ),
        ),
     ),
),