我尝试在我的 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: () {}),
),
];
}
}
最佳答案
关于flutter - 为什么我的 flutter 应用程序中的 FAB 大小很大?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55126106/