Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Crash when creating a CropRotateEditor #237

Open
PedroFaria99 opened this issue Oct 8, 2024 · 6 comments
Open

[Bug]: Crash when creating a CropRotateEditor #237

PedroFaria99 opened this issue Oct 8, 2024 · 6 comments
Labels
bug Something isn't working in-progress

Comments

@PedroFaria99
Copy link

PedroFaria99 commented Oct 8, 2024

Package Version

5.4.1

Flutter Version

3.24.3

Platforms

Android

How to reproduce?

When creating a CropRotateEditor, sometimes the editor turns completly black, as if the image was unable to be loaded, and a buch of errors shows on the logs.

image

For context, I am implementing a user profile picture up-loader, that's the 'image' variable below, the up-loader itself is working fine, allowing me to select a file from the gallery.
The problem is, sometimes, and only sometimes, when opening the editor as shown below, the entire thing crashes. Other times, this codes works perfectly and does exactly everything right, no problems at all, even multiple times in a row.
This odd behavior is making things hard to debug.

Logs (optional)

The relevant error-causing widget was:

Show
======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
Rect argument contained a NaN value.
'dart:ui/painting.dart':
Failed assertion: line 26 pos 10: '<optimized out>'


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.yml


  CropRotateEditor CropRotateEditor:file://lib/features/controllers/profile/profile.dart:52:50
When the exception was thrown, this was the stack: 
#2      _rectIsValid (dart:ui/painting.dart:26:10)
#3      _NativeCanvas.drawImageRect (dart:ui/painting.dart:6057:12)
#4      paintImage (package:flutter/src/painting/decoration_image.dart:697:14)
#5      RenderImage.paint (package:flutter/src/rendering/image.dart:434:5)
#6      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#7      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#8      RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#9      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#10     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#11     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#12     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#13     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#14     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#15     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#16     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#17     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#18     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#19     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#20     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#21     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#22     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#23     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#24     _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:392:15)
#25     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#26     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#27     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#28     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#29     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#30     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#31     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#32     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#33     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#34     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#35     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#36     DeferPointerRenderObject.paint (package:pro_image_editor/plugins/defer_pointer/defer_pointer.dart:122:13)
#37     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#38     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#39     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#40     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#41     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#42     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#43     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#44     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#45     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#46     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#47     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#48     RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:633:11)
#49     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#50     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#51     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#52     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#53     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#54     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#55     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#56     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#57     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#58     PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:487:12)
#59     PaintingContext.pushTransform (package:flutter/src/rendering/object.dart:677:7)
#60     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2547:27)
#61     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#62     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#63     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#64     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#65     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#66     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#67     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#68     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#69     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#70     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#71     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#72     _DeferredHitTargetRenderObject.paint (package:pro_image_editor/plugins/defer_pointer/deferred_pointer_handler.dart:115:11)
#73     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#74     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#75     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#76     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#77     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#78     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#79     RenderAnimatedOpacityMixin.paint (package:flutter/src/rendering/proxy_box.dart:1085:11)
#80     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#81     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:167:11)
#82     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:110:5)
#83     PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:262:7)
#84     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:243:7)
#85     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#86     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#87     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#88     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#89     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#90     _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:392:15)
#91     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#92     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#93     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#94     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#95     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#96     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#97     RenderCustomMultiChildLayoutBox.paint (package:flutter/src/rendering/custom_layout.dart:409:5)
#98     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#99     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#100    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#101    _RenderInkFeatures.paint (package:flutter/src/material/material.dart:609:11)
#102    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#103    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#104    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#105    RenderPhysicalModel.paint.<anonymous closure> (package:flutter/src/rendering/proxy_box.dart:2055:15)
#106    PaintingContext.pushClipRRect (package:flutter/src/rendering/object.dart:576:14)
#107    RenderPhysicalModel.paint (package:flutter/src/rendering/proxy_box.dart:2042:21)
#108    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#109    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#110    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#111    PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:487:12)
#112    RenderAnnotatedRegion.paint (package:flutter/src/rendering/proxy_box.dart:5058:13)
#113    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#114    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#115    _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:392:15)
#116    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#117    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#118    RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#119    RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#120    RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#121    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#122    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#123    RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#124    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#125    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#126    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#127    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#128    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#129    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#130    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#131    PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:167:11)
#132    PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:110:5)
#133    PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1183:31)
#134    PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1193:15)
#135    RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:604:23)
#136    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1164:13)
#137    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:468:5)
#138    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1397:15)
#139    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1318:9)
#140    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1176:5)
#141    _invoke (dart:ui/hooks.dart:312:13)
#142    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:419:5)
#143    _drawFrame (dart:ui/hooks.dart:283:31)
(elided 2 frames from class _AssertionError)
The following RenderObject was being processed when the exception was fired: RenderImage#37ba6
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(w=386.7, h=289.6)
...  size: Size(386.7, 289.6)
...  image: [259×194]
...  width: 426.7
...  height: 319.6
...  fit: contain
...  alignment: Alignment.center
...  invertColors: false
...  filterQuality: medium
RenderObject: RenderImage#37ba6
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=386.7, h=289.6)
  size: Size(386.7, 289.6)
  image: [259×194]
  width: 426.7
  height: 319.6
  fit: contain
  alignment: Alignment.center
  invertColors: false
  filterQuality: medium
====================================================================================================

======== Exception caught by rendering library =====================================================
The following UnsupportedError was thrown during paint():
Unsupported operation: Infinity or NaN toInt

The relevant error-causing widget was: 
  CropRotateEditor CropRotateEditor:file://lib/features/controllers/profile/profile.dart:52:50
When the exception was thrown, this was the stack: 
#0      double.toInt (dart:core-patch/double.dart)
#1      ImageSizeInfo._sizeToBytes (package:flutter/src/painting/debug.dart:94:51)
#2      ImageSizeInfo.displaySizeInBytes (package:flutter/src/painting/debug.dart:86:33)
#3      paintImage (package:flutter/src/painting/decoration_image.dart:658:56)
#4      RenderImage.paint (package:flutter/src/rendering/image.dart:434:5)
#5      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#6      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#7      RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#8      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#9      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#10     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#11     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#12     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#13     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#14     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#15     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#16     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#17     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#18     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#19     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#20     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#21     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#22     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#23     _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:392:15)
#24     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#25     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#26     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#27     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#28     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#29     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#30     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#31     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#32     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#33     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#34     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#35     DeferPointerRenderObject.paint (package:pro_image_editor/plugins/defer_pointer/defer_pointer.dart:122:13)
#36     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#37     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#38     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#39     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#40     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#41     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#42     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#43     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#44     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#45     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#46     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#47     RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:633:11)
#48     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#49     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#50     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#51     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#52     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#53     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#54     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#55     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#56     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#57     PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:487:12)
#58     PaintingContext.pushTransform (package:flutter/src/rendering/object.dart:677:7)
#59     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2547:27)
#60     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#61     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#62     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#63     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#64     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#65     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#66     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#67     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#68     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#69     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#70     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#71     _DeferredHitTargetRenderObject.paint (package:pro_image_editor/plugins/defer_pointer/deferred_pointer_handler.dart:115:11)
#72     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#73     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#74     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#75     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#76     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#77     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#78     RenderAnimatedOpacityMixin.paint (package:flutter/src/rendering/proxy_box.dart:1085:11)
#79     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#80     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:167:11)
#81     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:110:5)
#82     PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:262:7)
#83     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:243:7)
#84     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#85     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#86     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#87     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#88     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#89     _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:392:15)
#90     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#91     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#92     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#93     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#94     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#95     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#96     RenderCustomMultiChildLayoutBox.paint (package:flutter/src/rendering/custom_layout.dart:409:5)
#97     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#98     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#99     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#100    _RenderInkFeatures.paint (package:flutter/src/material/material.dart:609:11)
#101    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#102    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#103    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#104    RenderPhysicalModel.paint.<anonymous closure> (package:flutter/src/rendering/proxy_box.dart:2055:15)
#105    PaintingContext.pushClipRRect (package:flutter/src/rendering/object.dart:576:14)
#106    RenderPhysicalModel.paint (package:flutter/src/rendering/proxy_box.dart:2042:21)
#107    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#108    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#109    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#110    PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:487:12)
#111    RenderAnnotatedRegion.paint (package:flutter/src/rendering/proxy_box.dart:5058:13)
#112    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#113    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#114    _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:392:15)
#115    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#116    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#117    RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#118    RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#119    RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#120    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#121    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#122    RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#123    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#124    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#125    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#126    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#127    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#128    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#129    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#130    PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:167:11)
#131    PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:110:5)
#132    PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1183:31)
#133    PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1193:15)
#134    RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:604:23)
#135    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1164:13)
#136    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:468:5)
#137    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1397:15)
#138    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1318:9)
#139    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1176:5)
#140    _invoke (dart:ui/hooks.dart:312:13)
#141    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:419:5)
#142    _drawFrame (dart:ui/hooks.dart:283:31)
The following RenderObject was being processed when the exception was fired: RenderImage#9009e
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(w=386.7, h=289.6)
...  size: Size(386.7, 289.6)
...  image: [259×194]
...  width: 0.0
...  height: 0.0
...  fit: contain
...  alignment: Alignment.center
...  invertColors: false
...  filterQuality: medium
RenderObject: RenderImage#9009e
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=386.7, h=289.6)
  size: Size(386.7, 289.6)
  image: [259×194]
  width: 0.0
  height: 0.0
  fit: contain
  alignment: Alignment.center
  invertColors: false
  filterQuality: medium
====================================================================================================

======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
Rect argument contained a NaN value.
'dart:ui/painting.dart':
Failed assertion: line 26 pos 10: '<optimized out>'


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.yml

The relevant error-causing widget was: 
  CropRotateEditor CropRotateEditor:file://lib/features/controllers/profile/profile.dart:52:50
When the exception was thrown, this was the stack: 
#2      _rectIsValid (dart:ui/painting.dart:26:10)
#3      _NativeCanvas.drawRect (dart:ui/painting.dart:5964:12)
#4      _RenderColoredBox.paint (package:flutter/src/widgets/basic.dart:7816:22)
#5      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#6      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#7      RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#8      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#9      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#10     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#11     PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:487:12)
#12     RenderBackdropFilter.paint (package:flutter/src/rendering/proxy_box.dart:1252:15)
#13     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#14     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#15     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#16     PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:487:12)
#17     PaintingContext.pushClipRect (package:flutter/src/rendering/object.dart:547:7)
#18     RenderClipRect.paint (package:flutter/src/rendering/proxy_box.dart:1546:25)
#19     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#20     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#21     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#22     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#23     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#24     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#25     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#26     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#27     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#28     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#29     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#30     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#31     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#32     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#33     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#34     _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:392:15)
#35     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#36     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#37     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#38     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#39     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#40     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#41     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#42     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#43     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#44     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#45     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#46     DeferPointerRenderObject.paint (package:pro_image_editor/plugins/defer_pointer/defer_pointer.dart:122:13)
#47     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#48     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#49     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#50     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#51     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#52     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#53     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#54     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#55     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#56     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#57     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#58     RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:633:11)
#59     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#60     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#61     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#62     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#63     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#64     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#65     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#66     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#67     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#68     PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:487:12)
#69     PaintingContext.pushTransform (package:flutter/src/rendering/object.dart:677:7)
#70     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2547:27)
#71     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#72     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#73     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#74     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#75     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#76     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#77     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#78     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#79     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#80     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#81     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#82     _DeferredHitTargetRenderObject.paint (package:pro_image_editor/plugins/defer_pointer/deferred_pointer_handler.dart:115:11)
#83     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#84     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#85     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#86     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#87     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#88     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#89     RenderAnimatedOpacityMixin.paint (package:flutter/src/rendering/proxy_box.dart:1085:11)
#90     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#91     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:167:11)
#92     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:110:5)
#93     PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:262:7)
#94     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:243:7)
#95     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#96     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#97     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#98     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#99     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#100    _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:392:15)
#101    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#102    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#103    RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#104    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#105    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#106    RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#107    RenderCustomMultiChildLayoutBox.paint (package:flutter/src/rendering/custom_layout.dart:409:5)
#108    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#109    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#110    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#111    _RenderInkFeatures.paint (package:flutter/src/material/material.dart:609:11)
#112    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#113    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#114    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#115    RenderPhysicalModel.paint.<anonymous closure> (package:flutter/src/rendering/proxy_box.dart:2055:15)
#116    PaintingContext.pushClipRRect (package:flutter/src/rendering/object.dart:576:14)
#117    RenderPhysicalModel.paint (package:flutter/src/rendering/proxy_box.dart:2042:21)
#118    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#119    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#120    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#121    PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:487:12)
#122    RenderAnnotatedRegion.paint (package:flutter/src/rendering/proxy_box.dart:5058:13)
#123    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#124    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#125    _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:392:15)
#126    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#127    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#128    RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#129    RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#130    RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#131    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#132    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#133    RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#134    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#135    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#136    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#137    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#138    PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#139    RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#140    RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#141    PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:167:11)
#142    PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:110:5)
#143    PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1183:31)
#144    PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1193:15)
#145    RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:604:23)
#146    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1164:13)
#147    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:468:5)
#148    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1397:15)
#149    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1318:9)
#150    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1176:5)
#151    _invoke (dart:ui/hooks.dart:312:13)
#152    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:419:5)
#153    _drawFrame (dart:ui/hooks.dart:283:31)
(elided 2 frames from class _AssertionError)
The following RenderObject was being processed when the exception was fired: _RenderColoredBox#24043
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(w=386.7, h=289.6)
...  size: Size(386.7, 289.6)
...  behavior: opaque
  child: RenderPositionedBox#04c69 NEEDS-PAINT
    parentData: <none> (can use size)
    constraints: BoxConstraints(w=386.7, h=289.6)
    size: Size(386.7, 289.6)
    alignment: Alignment.center
    textDirection: ltr
    widthFactor: expand
    heightFactor: expand
RenderObject: _RenderColoredBox#24043
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=386.7, h=289.6)
  size: Size(386.7, 289.6)
  behavior: opaque
  child: RenderPositionedBox#04c69 NEEDS-PAINT
    parentData: <none> (can use size)
    constraints: BoxConstraints(w=386.7, h=289.6)
    size: Size(386.7, 289.6)
    alignment: Alignment.center
    textDirection: ltr
    widthFactor: expand
    heightFactor: expand
====================================================================================================

======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
Rect argument contained a NaN value.
'dart:ui/painting.dart':
Failed assertion: line 26 pos 10: '<optimized out>'

The relevant error-causing widget was: 
  CropRotateEditor CropRotateEditor:file://lib/features/controllers/profile/profile.dart:52:50
When the exception was thrown, this was the stack: 
#2      _rectIsValid (dart:ui/painting.dart:26:10)
#3      _NativePath.addRect (dart:ui/painting.dart:3001:12)
#4      CropCornerPainter._drawDarkenOutside (package:pro_image_editor/modules/crop_rotate_editor/widgets/crop_corner_painter.dart:157:9)
#5      CropCornerPainter.paint (package:pro_image_editor/modules/crop_rotate_editor/widgets/crop_corner_painter.dart:141:5)
#6      RenderCustomPaint._paintWithPainter (package:flutter/src/rendering/custom_paint.dart:588:13)
#7      RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:635:7)
#8      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#9      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#10     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#11     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#12     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#13     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#14     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#15     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#16     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#17     PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:487:12)
#18     PaintingContext.pushTransform (package:flutter/src/rendering/object.dart:677:7)
#19     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2547:27)
#20     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#21     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#22     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#23     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#24     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#25     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#26     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#27     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
#28     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#29     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#30     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#31     _DeferredHitTargetRenderObject.paint (package:pro_image_editor/plugins/defer_pointer/deferred_pointer_handler.dart:115:11)
#32     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#33     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#34     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#35     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#36     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#37     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#38     RenderAnimatedOpacityMixin.paint (package:flutter/src/rendering/proxy_box.dart:1085:11)
#39     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#40     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:167:11)
#41     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:110:5)
#42     PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:262:7)
#43     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:243:7)
#44     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#45     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#46     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#47     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#48     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#49     _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:392:15)
#50     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#51     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#52     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#53     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#54     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#55     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#56     RenderCustomMultiChildLayoutBox.paint (package:flutter/src/rendering/custom_layout.dart:409:5)
#57     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#58     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#59     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#60     _RenderInkFeatures.paint (package:flutter/src/material/material.dart:609:11)
#61     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#62     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#63     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#64     RenderPhysicalModel.paint.<anonymous closure> (package:flutter/src/rendering/proxy_box.dart:2055:15)
#65     PaintingContext.pushClipRRect (package:flutter/src/rendering/object.dart:576:14)
#66     RenderPhysicalModel.paint (package:flutter/src/rendering/proxy_box.dart:2042:21)
#67     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#68     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#69     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#70     PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:487:12)
#71     RenderAnnotatedRegion.paint (package:flutter/src/rendering/proxy_box.dart:5058:13)
#72     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#73     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#74     _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:392:15)
#75     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#76     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#77     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:3159:15)
#78     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#79     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#80     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#81     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#82     RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:76:15)
#83     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#84     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#85     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#86     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#87     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:251:13)
#88     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:136:13)
#89     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3268:7)
#90     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:167:11)
#91     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:110:5)
#92     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1183:31)
#93     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1193:15)
#94     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:604:23)
#95     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1164:13)
#96     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:468:5)
#97     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1397:15)
#98     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1318:9)
#99     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1176:5)
#100    _invoke (dart:ui/hooks.dart:312:13)
#101    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:419:5)
#102    _drawFrame (dart:ui/hooks.dart:283:31)
(elided 2 frames from class _AssertionError)
The following RenderObject was being processed when the exception was fired: RenderCustomPaint#e1787 relayoutBoundary=up17
...  needs compositing
...  parentData: offset=Offset(20.0, 20.0) (can use size)
...  constraints: BoxConstraints(0.0<=w<=386.7, 0.0<=h<=752.0)
...  size: Size(386.7, 289.6)
...  painter: null
...  foregroundPainter: CropCornerPainter#9d5da()
...  isComplex: true
...  willChange: true
RenderObject: RenderCustomPaint#e1787 relayoutBoundary=up17
  needs compositing
  parentData: offset=Offset(20.0, 20.0) (can use size)
  constraints: BoxConstraints(0.0<=w<=386.7, 0.0<=h<=752.0)
  size: Size(386.7, 289.6)
  painter: null
  foregroundPainter: CropCornerPainter#9d5da()
  isComplex: true
  willChange: true
...  child: RenderTransform#e4add relayoutBoundary=up18
...    needs compositing
...    parentData: <none> (can use size)
...    constraints: BoxConstraints(0.0<=w<=386.7, 0.0<=h<=752.0)
...    size: Size(386.7, 289.6)
...    transform matrix: [0] 1.0,0.0,0.0,0.0
[1] 0.0,1.0,0.0,0.0
[2] 0.0,0.0,1.0,0.0
[3] 0.0,0.0,0.0,1.0
...    origin: null
...    alignment: Alignment.center
...    textDirection: ltr
...    transformHitTests: true
...    child: RenderTransform#b893a relayoutBoundary=up19
...      needs compositing
...      parentData: <none> (can use size)
...      constraints: BoxConstraints(0.0<=w<=386.7, 0.0<=h<=752.0)
...      size: Size(386.7, 289.6)
...      transform matrix: [0] 1.0,0.0,0.0,NaN
[1] 0.0,1.0,0.0,NaN
[2] 0.0,0.0,1.0,0.0
[3] 0.0,0.0,0.0,1.0
...      origin: null
...      alignment: null
...      textDirection: ltr
...      transformHitTests: true
...      child: DeferPointerRenderObject#eb6f6 relayoutBoundary=up20
...        needs compositing
...        parentData: <none> (can use size)
...        constraints: BoxConstraints(0.0<=w<=386.7, 0.0<=h<=752.0)
...        size: Size(386.7, 289.6)
...        child: OutsideRenderPointerListener#3ab32 relayoutBoundary=up21
...          needs compositing
...          parentData: <none> (can use size)
...          constraints: BoxConstraints(0.0<=w<=386.7, 0.0<=h<=752.0)
...          size: Size(386.7, 289.6)
...          behavior: all
...          listeners: down, up, panZoomStart
====================================================================================================

======== Exception caught by scheduler library =====================================================
The following UnsupportedError was thrown during a scheduler callback:
Unsupported operation: Infinity or NaN toInt

When the exception was thrown, this was the stack: 
#0      double.toInt (dart:core-patch/double.dart)
#1      ImageSizeInfo._sizeToBytes (package:flutter/src/painting/debug.dart:94:51)
#2      ImageSizeInfo.displaySizeInBytes (package:flutter/src/painting/debug.dart:86:33)
#3      ImageSizeInfo.toJson (package:flutter/src/painting/debug.dart:109:29)
#4      paintImage.<anonymous closure> (package:flutter/src/painting/decoration_image.dart:671:52)
#5      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1397:15)
#6      SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1331:11)
#7      SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1176:5)
#8      _invoke (dart:ui/hooks.dart:312:13)
#9      PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:419:5)
#10     _drawFrame (dart:ui/hooks.dart:283:31)

Example code (optional)

if (image != null) {
      final content = await image.readAsBytes();
      await Navigator.push(
        context!,
        MaterialPageRoute(
          builder: (context) => CropRotateEditor.memory(
            content,
            initConfigs: CropRotateEditorInitConfigs(
              theme: ThemeData.light(),
              convertToUint8List: true,
              onImageEditingComplete: (bytes) async {

                //Check internet connection
                await NetworkManager.instance.validateConnection();

                //Update customer
                await CustomerRepository.addCustomerData('profilePicture', base64.encode(bytes));

                //Trigger change
                hasProfilePicture.value = false;
                await GetStorage().write(AppData.hasProfilePicture, true);
                hasProfilePicture.value = true;

                //Delete file
                io.File(image.path).deleteSync();

                //Close editor
                Navigator.pop(context);

                //Send to server
                await CustomerRepository.updateProfile(base64.encode(bytes));
              },
              configs: ProImageEditorConfigs(
                designMode: platformDesignMode,
                imageGenerationConfigs: const ImageGenerationConfigs(
                  outputFormat: OutputFormat.png,
                  pngFilter: PngFilter.none
                ),
                cropRotateEditorConfigs: const CropRotateEditorConfigs(
                  roundCropper: true,
                  canChangeAspectRatio: false,
                  initAspectRatio: 1,
                )
              )
            )
          )
        ),
      );
    }
@PedroFaria99 PedroFaria99 added the bug Something isn't working label Oct 8, 2024
@PedroFaria99
Copy link
Author

I was able to track this.

image

It appears there's something wrong with calculations when opening the editor.

@PedroFaria99
Copy link
Author

Furthermore, i found this issue while debugging.

image

It seems the paiting of the image on the editor has some sort of an issue to it.

@hm21
Copy link
Owner

hm21 commented Oct 8, 2024

Thank you for all the information.

This issue will be a challenge to resolve because, as you mentioned, “The problem is, sometimes, and only sometimes,” which complicates troubleshooting. It appears there was an issue in calculating the image size before rendering, which is essential for the transformations to function correctly.

However, if I can find time over the next few days, I’ll take a closer look to see if I can identify a solution.

One small thing you could try, which may help resolve the issue, is to load the image into the cache before opening the editor. This could potentially resolve the issue cuz all image information is faster available for the image editor.

final content = await image.readAsBytes();

/// Add the code below
await precacheImage(
  MemoryImage(content),
  context,
);
await Navigator.push(...)

@PedroFaria99
Copy link
Author

Yes the provided solution did indeed fix the issue. However this is a temporary fix and we'll be expecting a global fix soon.
Thank you for your time. I'm closing the issue.

@PedroFaria99
Copy link
Author

After a few more tests, it seems the issue still exists. The solution provided did in fact mitigate the number of times it happens, but it does in fact still happen.

Copy link

This issue is stale because it has been open for 3 days with no activity.

@github-actions github-actions bot added the stale Inactive issue label Oct 13, 2024
@github-actions github-actions bot removed the stale Inactive issue label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in-progress
Projects
None yet
Development

No branches or pull requests

2 participants