Skip to content

fix(crop-rotate-editor): ignore setState after dispose and color undo/redo with appBarColor - #873

Merged
hm21 merged 1 commit into
stablefrom
claude/issues-858-856-58eed1
Sep 24, 2026
Merged

hm21 merged 1 commit into
stablefrom
claude/issues-858-856-58eed1

Conversation

@hm21

@hm21 hm21 commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Description

Two crop-rotate editor bugs, fixed in one PR.

#858: Bad state: Cannot add new events after calling close

ScreenResizeDetector.onResizeEnd fires from a 50 ms debounce, and the crop editor responds by scheduling a post-frame callback that calls _updateAllStates() → setState(). If the editor is removed in the frame where that debounce fires, dispose() has already closed rebuildController by the time the callback runs, and rebuildController.add(null) throws. The UI isn't affected, but apps that forward FlutterError.onError to Crashlytics/Sentry report it as a crash.

  • The setState overrides of the blur, crop, filter, paint, text and tune editors now return early when the state isn't mounted. The main editor already did this.
  • The crop editor's three post-frame callbacks (the two in initState and the one in onResizeEnd) also return early when the state isn't mounted, so they no longer call calcFitToScreen() / _setCropRectBounding() on disposed animation controllers.

#856: undo/redo ignore appBarColor

The undo and redo icons in CropEditorAppbar and TuneEditorAppbar were hardcoded to Colors.white / Colors.white.withAlpha(80). The done button follows appBarColor, so with a light appBarBackground undo and redo disappeared. They now use style.appBarColor (with alpha 80 when disabled), as PaintEditorAppbar already does. kImageEditorAppBarColor is white, so the default look is unchanged. The frosted-glass example designs hardcode white on purpose and are unchanged.

Related Issue: Closes #858, closes #856

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

Tests

…/redo with appBarColor

The resize-end handler of the crop editor schedules a post-frame callback
that runs even when the editor was disposed in the same frame. It then
called setState, which added to the already closed rebuildController and
threw "Bad state: Cannot add new events after calling close" (#858).

The setState overrides of the blur, crop, filter, paint, text and tune
editors now return early when the state is no longer mounted, as the main
editor already did. The crop editor's post-frame callbacks also bail out
before touching its disposed animation controllers.

The undo and redo icons of the crop and tune app bars were hardcoded to
white, so they vanished on a light appBarBackground while the done button
followed appBarColor. They now use appBarColor like the paint editor
(#856). The default appBarColor is white, so the default look is unchanged.
@hm21
hm21 merged commit 7b42381 into stable Sep 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant