为什么我的flutter应用程序中的FAB大小很大?

问题描述 投票:0回答:2

click to see the screenshot of the problem我试着在我的PhotoViewer(计划)中添加一些标记作为浮动按钮以便以后使用它们!但IDK为什么按钮显示得如此之大以至于必须如此!

class _MyHomePageState extends State<MyHomePage> {[enter image description here][1]
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(),
          body: plan(),
          floatingActionButton: FloatingActionButton(child: Icon(Icons.add), onPressed: () {}),
        );
      }

      Widget plan() {
        return PhotoView.customChild(
          child: Stack(
            children: widgets(),
          ),
          childSize: const Size(250.0, 220.0),
          minScale: PhotoViewComputedScale.contained,
          maxScale: PhotoViewComputedScale.covered * 1.8,
          initialScale: PhotoViewComputedScale.contained * 0.5,
        );
      }

      List<Widget> widgets() {
        return [
          Container(
            decoration: new BoxDecoration(
              image: new DecorationImage(
                image: new AssetImage("data_repo/img/bg1.jpg"),
                fit: BoxFit.cover,
              ),
            ),
          ),
          Center(
            child: FloatingActionButton(child: Icon(Icons.add), onPressed: () {}),
          ),
        ];
      }
    }
layout responsive-design dart flutter size
2个回答
0
投票

如果你想使用一个较小的FAB,你可以将mini属性设置为true,它会改变它。

Here some information

希望能帮助到你。


0
投票

我不知道原因,但我设法调整按钮大小如下:

Transform.scale(
  scale : 0.5,
  child : FloatingActionButton(child: Icon(Icons.add), onPressed: () {}),
),
© www.soinside.com 2019 - 2024. All rights reserved.