Fix Smart Send UX + dialog controller disposal crash - #3
Merged
Merged
Conversation
…by adding file_selector for native file picking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two things in this PR:
1. Smart Send UI improvements
Reworked the UI for better UX and swapped in
file_selectorfor native file picking instead of the previous approach.2. Fix controller disposal crash during dialog exit animations
Was hitting a cascade of crashes on the "Send a link", encryption-key, and IPFS gateway dialogs:
TextEditingController used after being disposed_dependents.isEmptyassertion failureDuplicate GlobalKeys detected in widget treeTried to build dirty widget in the wrong build scopeRoot cause: these dialogs created their
TextEditingControllerin the caller and disposed it immediately aftershowDialogreturned — but the dialog can still be mid-transition (reverse animation) and rebuild against the now-disposed controller.Fix: moved each dialog into its own
StatefulWidgetthat owns and disposes its own controller indispose(), so the controller's lifecycle matches the dialog's actual lifetime instead of the caller's.Also added
mountedchecks around the encryption-key dialog's async file-read path, since it had the same class of bug (writing to a controller after an await without checking the dialog was still alive).Preserved existing behavior: clipboard prefill, paste, button enablement, dismissal results, gateway save callback, and the encryption dialog's barrier-dismiss-blocked behavior.
Testing: Added regression tests covering confirm/cancel/back/barrier dismissal, rebuilds during reverse transitions, fresh controller state on reopen, and late async completion after disposal. All tests pass. Manually verified on device — rapid dialog open/dismiss no longer triggers the crash.