diff --git a/CHANGELOG.md b/CHANGELOG.md index 72cf30bc1..427fa42f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 11.20.1 +- **FIX**: Resolve issue where DeferPointer shows an error when the hero animations is running for the text layers from the custom screens. + ## 11.20.0 - **FEAT**(main-editor): Add the flag `enableSubEditorPage` which allows sub-editors to be opened with the same constraints as the editor itself. More details in PR [#752](https://github.com/hm21/pro_image_editor/pull/752). diff --git a/lib/plugins/defer_pointer/defer_pointer.dart b/lib/plugins/defer_pointer/defer_pointer.dart index 2d4527456..3ce157835 100644 --- a/lib/plugins/defer_pointer/defer_pointer.dart +++ b/lib/plugins/defer_pointer/defer_pointer.dart @@ -32,7 +32,12 @@ class DeferPointer extends StatelessWidget { @override Widget build(BuildContext context) { - final link = this.link ?? DeferredPointerHandler.of(context).link; + final link = this.link ?? DeferredPointerHandler.maybeOf(context)?.link; + + if (link == null) { + return child; + } + return _DeferPointerRenderObjectWidget( link: link, deferPaint: paintOnTop, diff --git a/lib/plugins/defer_pointer/deferred_pointer_handler.dart b/lib/plugins/defer_pointer/deferred_pointer_handler.dart index c13ebdcbc..33a4149a4 100644 --- a/lib/plugins/defer_pointer/deferred_pointer_handler.dart +++ b/lib/plugins/defer_pointer/deferred_pointer_handler.dart @@ -22,13 +22,20 @@ class DeferredPointerHandler extends StatefulWidget { DeferredPointerHandlerState createState() => DeferredPointerHandlerState(); /// The state from the closest instance of this class that encloses the given - /// context. - static DeferredPointerHandlerState of(BuildContext context) { + /// context, or null if there is no instance in the tree. + static DeferredPointerHandlerState? maybeOf(BuildContext context) { final inherited = context .dependOnInheritedWidgetOfExactType<_InheritedDeferredPaintSurface>(); - assert(inherited != null, - 'DeferredPaintSurface was not found on this context.'); - return inherited!.state; + return inherited?.state; + } + + /// The state from the closest instance of this class that encloses the given + /// context. + static DeferredPointerHandlerState of(BuildContext context) { + final DeferredPointerHandlerState? result = maybeOf(context); + assert( + result != null, 'DeferredPaintSurface was not found on this context.'); + return result!; } } diff --git a/pubspec.yaml b/pubspec.yaml index 83ed70679..e989673d6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: pro_image_editor description: "A Flutter image editor: Seamlessly enhance your images with user-friendly editing features." -version: 11.20.0 +version: 11.20.1 homepage: https://github.com/hm21/pro_image_editor/ repository: https://github.com/hm21/pro_image_editor/ documentation: https://github.com/hm21/pro_image_editor/