[英]Why the size of the FAB in my flutter app is big?
I tried to add some markers in my PhotoViewer (plan) as a floating buttons to use them later !我尝试在我的 PhotoViewer(计划)中添加一些标记作为浮动按钮以供以后使用! but IDK why is the button is showing up so big that it must be !但是 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: () {}),
),
];
}
}
If you want o use a smaller FAB you can set the mini property to true and its gonna change it.如果您想使用较小的 FAB,您可以将 mini 属性设置为 true 并更改它。
Hope it helps.希望能帮助到你。
I didn't know the reason but i managed to resize the button like so :我不知道原因,但我设法像这样调整按钮的大小:
Transform.scale(
scale : 0.5,
child : FloatingActionButton(child: Icon(Icons.add), onPressed: () {}),
),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.