The code change allows to override the default behaviour of clicking on
images and thus solves #90.
Now the only thing left to do is to use a `RawGestureDetector` in the
`EmbedBuilder` to deactivate the "old" behaviour (by entering the
GestureArena and win). The `embedBuilder` could look like this:
```dart
Widget embedBuilder(BuildContext context, Embed node, bool readOnly) {
return FutureBuilder<File>(
future: File('image_path.png'),
builder: (context, snapshot) {
final gestures = {
ReadDependentGestureRecognizer: GestureRecognizerFactoryWithHandlers<
ReadDependentGestureRecognizer>(
() => ReadDependentGestureRecognizer(readOnly: readOnly),
(instance) => instance
..onTapUp = ((_) => print('Test'))
)
};
return RawGestureDetector(
gestures: gestures,
child: Image.file(snapshot.data),
);
}
);
}
class ReadDependentGestureRecognizer extends TapGestureRecognizer {
ReadDependentGestureRecognizer({@required this.readOnly});
final bool readOnly;
@override
bool isPointerAllowed(PointerDownEvent event) {
if (!readOnly) {
return false;
}
return super.isPointerAllowed(event);
}
}
```
**Explanation of the code:**
When a `PointerDownEvent` is received by the `GestureBinding` a hit
test is performed to determine which `HitTestTarget` nodes are affected.
For this the (I think) element tree is traversed downwards to find
out which elements has been hit. To find out which elements were
hit, the method `hitTestSelf` and `hitTestChildren` are used. Since
the `hitTestChildren` method of `TextLine` has not been implemented
yet, `false` was always returned, which is why the hit test
never arrived at the `embedBuilder`. With the code change, the hit is
passed on and can be processed correctly in the embed.
Additionally I removed the class `_TransparentTapGestureRecognizer`,
because this class always accepted the gesture, even if the recognizer
lost in the arena.
Development on the quiver_* subpackages has been discontinued in favour
of the main quiver package at https://github.com/google/quiver-dart. The
code itself is identical, but is more actively maintained.
Updated the dependency on the tuple package to 2.0.0, since it also
depends on quiver 3.0.0. Both packages has been migrated to null-safety
at those versions.