lykhonis / image_crop

A flutter plugin to crop image on iOS and Android.
Apache License 2.0
328 stars 202 forks source link

Fix premature _boundaries getter execution #83

Closed wrbl606 closed 2 years ago

wrbl606 commented 2 years ago

For long lived Crop widgets (eg. widgets that are stored on navigator stack for some time and then pop-out to the user again) there was an issue that the Crop widget rendered blank background rather than actual image with cropping UI.

The issue was caused by premature call to _boundaries getter which depends on _surfaceKey.currentContext. The logic in didChangeDependencies was flawed because it was expecting _surfaceKey.currentContext to be present but didn't make sure that the build function already ran which would correctly assign GestureDetector's state and context to the key.

It wasn't an issue in earlier Flutter versions, but it is now and it have app-breaking potential.