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: () {}),
),
];
}
}
我不知道原因,但我设法调整按钮大小如下:
Transform.scale(
scale : 0.5,
child : FloatingActionButton(child: Icon(Icons.add), onPressed: () {}),
),