Declaring variables as final when possible is a good practice
because it helps avoid accidental reassignments and allows the
compiler to do optimizations.
* Upgrade upgradable packages
* Apply default null-safety migrations
* Remove hashnode as a dependency and localize its functionality to the package.
Maintenance was done long time ago hence no need to wait for the update
* Localize ui package to reduce maintenance burdens
* Replace universal html with dart:html
* Remove unnecessary checks
* Fix formatting
* Migrate app to null safety
* Enable methods to be nullable
* Fix non-nullable issue with node methods
* Cast as Node
* Use universal html
* Use universal html package to bring in the ImageElement class
* Remove unused imports
* Fix imports on the editor file
* Add key to quill editor
* Remove final from the GlobalKey
* Remove final on GlobalKey
* Remove custom util implementation in favor of quiver
* Fix issue with null on token attrivute
* Remove final hashcode that is replaced by quiver functionality
* Fix merge request
* Fix hit test position in text_line.dart
* Fix null safety errors on text_selection.dart
* Fix sound null safe errors in toolbar.dart
* Import null safe file picker
* Fix issue with basic text editing and editor display
* Fix issues with basic widget rendering and editing
* Upgrade upgradable packages
* Apply default null-safety migrations
* Remove hashnode as a dependency and localize its functionality to the package.
Maintenance was done long time ago hence no need to wait for the update
* Localize ui package to reduce maintenance burdens
* Replace universal html with dart:html
* Remove unnecessary checks
* Fix formatting
* Migrate app to null safety
* Enable methods to be nullable
* Fix non-nullable issue with node methods
* Cast as Node
* Use universal html
* Use universal html package to bring in the ImageElement class
* Remove unused imports
* Fix imports on the editor file
* Add key to quill editor
* Remove final from the GlobalKey
* Remove final on GlobalKey
* Remove custom util implementation in favor of quiver
* Fix issue with null on token attrivute
* Remove final hashcode that is replaced by quiver functionality
* Fix merge request
* Fix hit test position in text_line.dart
* Fix null safety errors on text_selection.dart
* Fix sound null safe errors in toolbar.dart
* Import null safe file picker
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.