您好,我已經實作了雙擊以放大顫振應用程式,但是當影像縮放時,當它處于縮放位置時,我無法導航到影像的其他部分。捏縮放作業正常,雙擊縮放并重置為正常也作業正常。唯一的問題是在縮放狀態下無法在影像中移動。請幫助我,這是我的代碼:
GestureDetector(
onDoubleTapDown: (details) {
tapDownDetails = details;
},
onDoubleTap: () {
final position = tapDownDetails?.localPosition;
final double scale = 4;
final x = -position!.dx * (scale - 1);
final y = -position.dy * (scale - 1);
final zoomed = Matrix4.identity()
..translate(x, y)
..scale(scale);
final end = _controller!.value.isIdentity()
? zoomed
: Matrix4.identity();
_animation = Matrix4Tween(
begin: _controller?.value,
end: end,
).animate(
CurveTween(curve: Curves.easeInOut)
.animate(_animationController!),
// CurvedAnimation(parent: _animationController!, curve: Curves.easeInOut),
);
_animationController?.forward(from: 0);
},
child: InteractiveViewer(
transformationController: _controller,
clipBehavior: Clip.none,
panEnabled: false,
minScale: minScale,
maxScale: maxScale,
onInteractionStart: (details) {
if (details.pointerCount < 2) return;
if (entry == null) {
showOverlay(context);
}
},
onInteractionUpdate: (details) {
if (entry == null) return;
this.scale = details.scale;
entry!.markNeedsBuild();
},
onInteractionEnd: (details) {
if (details.pointerCount != 1) return;
resetAnimation();
},
child: Image(
image: imageProvider,
),
),
),
uj5u.com熱心網友回復:
洗掉此行或設定為true默認值。這將啟用平移。
panEnabled: true,
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/470225.html
上一篇:影像資源服務捕獲的例外(已在pubspec.yaml檔案中添加資產)
下一篇:我想在顫動的兩個陣列值之間相乘
