Skip to content

Commit

Permalink
fix: state goes back to preparing when didChangeDependencies called (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
chooyan-eng committed Dec 11, 2024
1 parent 075d3b3 commit 8212d2f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/src/widget/crop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,6 @@ class _CropEditorState extends State<_CropEditor> {

@override
void didChangeDependencies() {
_viewState = PreparingCropEditorViewState(
viewportSize: MediaQuery.of(context).size,
withCircleUi: widget.withCircleUi,
aspectRatio: widget.aspectRatio,
);

/// parse image with given parser and format detector
_parseImageWith(
parser: widget.imageParser,
Expand Down Expand Up @@ -415,13 +409,19 @@ class _CropEditorState extends State<_CropEditor> {
_lastImage == image &&
_lastFormatDetector == formatDetector) {
// no change
return null;
return _parsedImageDetail;
}

_lastParser = parser;
_lastFormatDetector = formatDetector;
_lastImage = image;

_viewState = PreparingCropEditorViewState(
viewportSize: MediaQuery.of(context).size,
withCircleUi: widget.withCircleUi,
aspectRatio: widget.aspectRatio,
);

final format = formatDetector?.call(image);
final future = compute(
_parseFunc,
Expand Down

0 comments on commit 8212d2f

Please sign in to comment.