First of all, I want to use InteractiveViewer to be able to move, scale and zoom freely in a document that I have a boundaryMargin (this is important to separate the document with a margin).
Then, inside this InteractiveViewer, I have a child that I use a DragTarget and Draggable, this because inside the document I will be able to draw with an icon...
The problem comes that when I want to draw, I disable the scale, the move and the zoom of InteractiveViewer in the variable panEnabled and scaleEnabled, and I activate my Draggable, otherwise, I enable it again (InteractiveViewer), but, when I am drawing, IT TAKES LONG TO PUT THE DRAWING because first it detects in the InteractiveViewer and then the drawing appears and I don't want that... I want that when I draw, in the first gesture, appears at least a point and it doesn't happen like that, it takes less than a second because it is as parent of the InteractiveViewer, and I can't use an IgnorePointer because it ignores both the InteractiveViewer and the Draggable and I don't know what to do.
And yes, the Draggable must be a child because I get the measurements from the boundaryMargin, and if I take it out, it doesn't work, but could be ? I need your help.
My CODE :
Widget build(BuildContext context) {
return Stack(
children: [
// I WANT TO IGNORE THE POINTER FROM INTERACTIVE, but not the pointer from Draggable
InteractiveViewer(
transformationController: planController,
boundaryMargin: EdgeInsets.all(Device.screenWidth / 1.5),
constrained: false,
panEnabled: isPanning, /// [isPanning] boolean that means if the user is panning in the Document or Not
scaleEnabled: isPanning,
maxScale: maxScale,
minScale: minScale,
// * ON UPDATE
onInteractionUpdate: (ScaleUpdateDetails uiDetails) =>
_updateMiniController(), /// SOME CODE not necessary
// * BORDER
child: Container(
clipBehavior: Clip.none,
height: indice.height, /// document's size
width: indice.width,
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey,
width: 1,
style: BorderStyle.solid,
),
),
// * DRAG TARGET
child: DragTarget<PlanAction>(
// * DRAG - ON ACCEPT
onAcceptWithDetails: (DragTargetDetails details) => [...],
onMove: (details) {
[...]
},
// * DRAG - BUILDER
builder: (context, candidates, rejects) {
return Stack(
children: [
// * AIMING DRAWING FOR ZONE
/// This is only for showing the `synchronizedTiles`
IgnorePointer(
/// `ignoring` : [true] is for ignoring the drawing, [false] is for panning
ignoring: isPanning,
/// * HERE WE GONA SHOW THE DRAGGABLE ICON
child: Draggable<PlanAction>(
/// Show the point to draw
feedback: const AimingFeedbackIcon(),
/// Only 1 finger could draw
maxSimultaneousDrags: 1,
data: [...],
dragAnchorStrategy: [...],
child: Stack(
alignment: Alignment.topLeft,
children: <Widget>[
Positioned(
child: Container(
height: indice.height,
width: indice.width,
color: Colors.red[200],
),
),
],
),
),
),
// * CANVAS DRAWING
IgnorePointer(
ignoring: true,
child: NewZoneDrawing(
height: indice.height,
width: indice.width,
),
),
],
);
},
),
),
),
[...]
],
);
}
