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

标签 flutter layout dart responsive-design flutter-widget

click to see the screenshot of the problem

我尝试在我的 PhotoViewer(计划)中添加一些标记作为 float 按钮以供稍后使用!但我不知道为什么按钮会出现 这么大,一定是这样!

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: () {}),
          ),
        ];
      }
    }

最佳答案

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

Here some information

希望有帮助。

关于flutter - 为什么我的 flutter 应用程序中的 FAB 大小很大?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55126106/

相关文章:

android - 将点击方向更改为 View 底部

android - 如何从另一个自定义 XML 布局引用自定义 XML 布局?

flutter - 如何在Flutter中清除ListViewBuilder中的对象?

flutter - 为什么我的onPressed回调不能使用Bloc调用我的Bloc?

firebase - 如何从引用文档 (Firebase) 中的字段获取字符串数据

Flutter 如何在 flutter 中显示列表 -- 每行 2 个项目

Flutter:仅在 Release模式下运行时才在空值上使用空检查运算符,而不是调试

ios - 在创建时向 UITableViewCell 添加偏移量?

android-studio - Flutter 检查器面板字体过大

flutter - flutter中如何去掉table最外层的边框线| flutter