Modalbottomsheet上的InteractiveViewer
我正在尝试使用InteractiveViewer
使用showmodalbottomsheet
。我希望用户能够缩放,然后使用捏和锅手势浏览照片。不幸的是,当我垂直做一个锅手势时,垂直draggesturerecognizer
在手势领域的scale> scale> scale> scale> scale> scale> scale> scale>。
flutter: Gesture arena 48 ❙ ★ Opening new gesture arena.
flutter: Gesture arena 48 ❙ Adding: ScaleGestureRecognizer#962c4(debugOwner: GestureDetector)
flutter: Gesture arena 48 ❙ Adding: VerticalDragGestureRecognizer#57396(debugOwner: GestureDetector, start behavior: start)
flutter: Gesture arena 48 ❙ Closing with 2 members.
flutter: Gesture arena 48 ❙ Accepting: VerticalDragGestureRecognizer#57396(debugOwner: GestureDetector, start behavior: start)
flutter: Gesture arena 48 ❙ Self-declared winner: VerticalDragGestureRecognizer#57396(debugOwner: GestureDetector, start behavior: start)
这是我所知道的底部表代码
class PhotoViewerSheet extends StatelessWidget {
static String route = '/photo-viewer';
final ScoutingNoteAttachmentFile image;
const PhotoViewerSheet({
Key? key,
required this.image,
}) : super(key: key);
static Future<void> show(BuildContext context) {
return showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) => Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16.0),
topRight: Radius.circular(16.0),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 10),
const AppBottomSheetHeader(text: 'Photo'),
const SizedBox(height: 10),
SizedBox(
height: context.screenHeight * 0.5,
width: context.screenWidth,
child: InteractiveViewer(
child: const FlutterLogo(size: 200),
),
),
],
),
),
);
}
}
,在这种情况下,RawgentureDetector可能会有所帮助,但我不知道如何在这里使用它。
I'm trying to use InteractiveViewer
inside modal bottom sheet using showModalBottomSheet
. I want user to be able to zoom and then move through the photo using pinch and pan gestures. Unfortunately when I do a pan gesture vertically, VerticalDragGestureRecognizer
is winning over ScaleGestureRecognizer
on gesture arena.
flutter: Gesture arena 48 ❙ ★ Opening new gesture arena.
flutter: Gesture arena 48 ❙ Adding: ScaleGestureRecognizer#962c4(debugOwner: GestureDetector)
flutter: Gesture arena 48 ❙ Adding: VerticalDragGestureRecognizer#57396(debugOwner: GestureDetector, start behavior: start)
flutter: Gesture arena 48 ❙ Closing with 2 members.
flutter: Gesture arena 48 ❙ Accepting: VerticalDragGestureRecognizer#57396(debugOwner: GestureDetector, start behavior: start)
flutter: Gesture arena 48 ❙ Self-declared winner: VerticalDragGestureRecognizer#57396(debugOwner: GestureDetector, start behavior: start)
Here is my bottom sheet code
class PhotoViewerSheet extends StatelessWidget {
static String route = '/photo-viewer';
final ScoutingNoteAttachmentFile image;
const PhotoViewerSheet({
Key? key,
required this.image,
}) : super(key: key);
static Future<void> show(BuildContext context) {
return showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) => Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16.0),
topRight: Radius.circular(16.0),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 10),
const AppBottomSheetHeader(text: 'Photo'),
const SizedBox(height: 10),
SizedBox(
height: context.screenHeight * 0.5,
width: context.screenWidth,
child: InteractiveViewer(
child: const FlutterLogo(size: 200),
),
),
],
),
),
);
}
}
From what I know, RawGestureDetector could help in this situation but I don't know how to use it here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
indrorepointer
或apporbpointer
如果要禁用其他手势检测器喜欢:
或者您也可以为
transformationController
添加transformation Controller
喜欢
you can use
IngrorePointer
orAbsorbPointer
if you want disable other gesture detectorslike:
or also you can add
TransformationController
fortransformationController
like