Skip to content

Fix Smart Send UX + dialog controller disposal crash - #3

Merged
Shachindra merged 2 commits into
NetSepio:mainfrom
BunnyPraneeth5:main
Sep 7, 2026
Merged

Shachindra merged 2 commits into
NetSepio:mainfrom
BunnyPraneeth5:main

Conversation

@BunnyPraneeth5

Copy link
Copy Markdown
Contributor

Two things in this PR:

1. Smart Send UI improvements
Reworked the UI for better UX and swapped in file_selector for 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.isEmpty assertion failure
  • Duplicate GlobalKeys detected in widget tree
  • Tried to build dirty widget in the wrong build scope

Root cause: these dialogs created their TextEditingController in the caller and disposed it immediately after showDialog returned — but the dialog can still be mid-transition (reverse animation) and rebuild against the now-disposed controller.

Fix: moved each dialog into its own StatefulWidget that owns and disposes its own controller in dispose(), so the controller's lifecycle matches the dialog's actual lifetime instead of the caller's.

Also added mounted checks 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.

@Shachindra Shachindra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Shachindra
Shachindra merged commit a8feaea into NetSepio:main Sep 7, 2026
1 check 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

Development

Successfully merging this pull request may close these issues.

2 participants