-
-
Notifications
You must be signed in to change notification settings - Fork 504
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 report] SetState will Reset ExtendedImage and clear the Crop State #712
Comments
This is quite critical since we cannot customize the editor and cannot fetch the crop's information. |
as design , you should update state by controller |
you should update only Text(info) state |
I believe the widget should not reset its state when the parent calls setState, as this design significantly limits user customization and its compatibility with other widgets. Requiring an isolated environment for the widget to function makes it inconvenient and less practical for broader use. Is there a specific reason why this widget needs to unnecessarily reset its state? |
Just checked, and version 9.06 works fine with it. It seems there might be a minor bug introduced in the 9.07 update. |
I quickly checked the commits, and this issue might be caused by the equality check in lib/src/editor/editor_config.dart: @Override
int get hashCode {
return Object.hash(
maxScale,
cropRectPadding,
cornerSize,
cornerColor,
lineColor,
lineHeight,
editorMaskColorHandler,
hitTestSize,
animationDuration,
tickerDuration,
cropAspectRatio,
initialCropAspectRatio,
initCropRectType,
cropLayerPainter,
speed,
hitTestBehavior,
editActionDetailsIsChanged,
reverseMousePointerScrollDirection,
controller,
);
} The issue seems to be introduced in lib/src/editor/editor.dart: if (oldConfig == config) {
return;
}
_editorConfig = config; Since the object is immutable, it always fails value equality checks, which forces the widget to reset everything. I haven’t tested the code yet—this conclusion is based on a quick review of the commits. @zmtzawqlp |
reset state when didUpdateWidget. make sure the state is clearing |
Version
^9.0.7
Platforms
Android, iOS
Device Model
emulator, iPhone 15 Pro Plus
flutter info
How to reproduce?
dart editActionDetailsIsChanged
part and the crop will not work at all since the bugLogs
No response
Example code (optional)
Contact
No response
The text was updated successfully, but these errors were encountered: