我试图在我的 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: () {}),
),
];
}
}