[英]How to pan only with left mouse button in flutter interactive viewer?
I have an interactive viewer which encapsulates an image.我有一个封装图像的交互式查看器。 I want the user to only be able to pan with left mouse button and open a menu on right click.我希望用户只能用鼠标左键平移并在右键单击时打开菜单。 Currently the menu opens with right click and image also get panned with right click.当前菜单通过右键单击打开,并且图像也通过右键单击进行平移。 Is there a way to stop panning with right click in interactive viewer?有没有办法在交互式查看器中通过右键单击停止平移?
Widget build(BuildContext context) {
return Center(
child: InteractiveViewer(
transformationController: _controller,
boundaryMargin: EdgeInsets.all(10000),
clipBehavior: Clip.none,
minScale: 0.0001,
maxScale: 10,
constrained: true,
child: Stack(
children: [
Align(
alignment: AlignmentDirectional(0, 0),
child: Image(
image: AssetImage(widget.imagePat),
filterQuality: FilterQuality.medium,
isAntiAlias: true,
),
),
Align(
alignment: AlignmentDirectional(0.11, 0.09),
child: SizedBox(
width: 40,
height: 40,
child: TextButton(
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(24, 0, 0, 0)),
onPressed: () => {},
child: Container(),
),
),
),
],
),
),
);
}
(smooth animation won't work after that) Also, it probably won't work on mobile. (之后平滑的 animation 将无法工作)此外,它可能无法在移动设备上使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.