I have a gesture detector and wrapped it around a interactive viewer. But when I do, panning and scaling no longer work on my InteractiveViewer. Or atleast it responds very poorly to input.
This is my GestureDetector
class MyPage extends StatelessWidget {
const MyPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTapDown: (_) => context.read<TutorialBloc>().rewind(),
onVerticalDragStart: (_) => context.read<TutorialBloc>().rewind(),
onHorizontalDragStart: (_) => context.read<TutorialBloc>().rewind(),
onTapUp: (_) => context.read<TutorialBloc>().resume(),
onVerticalDragEnd: (_) => context.read<TutorialBloc>().resume(),
onHorizontalDragEnd: (_) => context.read<TutorialBloc>().resume(),
child: Scaffold(
body: Center(
child: Container(
width: 100,
height: 100,
child: InteractiveViewer(
child: Container(color: Colors.blue),
),
),
),
),
);
}
}
The InteractiveViewer will respond poorly to input. I tried setting this
behavior: HitTestBehavior.deferToChild
and
behavior: HitTestBehavior.translucent
But it does not work
How can I fix this?
Also with the gesture detector I am trying to detect a tap anywhere on the page whil the interactive viewer only is a small part of the page.
Side Note: Just is just some example code the to illustrate the widget structure. In reality the container is not just blue and the Interactive Viewer is nested deeper.