refactor(ui): internalize AppBar back-vs-close, drop backButton flag - #1207
Merged
Conversation
AppBarWithTitle now derives its leading control from context instead of
each sheet screen hand-rolling `remember { navigator.backStack.size <= 1 }`
to choose back-vs-close:
- The signal is a non-null `onBackIconClicked` (the `backButton: Boolean`
param is removed; every call site already passed a handler).
- Icon adapts: a Close (X) when the screen can only leave its scope — the
root of a sheet's own back stack (LocalSheetNavigator present) or a flow
that opted into FlowDismissStyle.Close — and a back arrow otherwise.
- Flow navigators are excluded from the sheet-root check so they keep
driving the swap via flowDismissStyle (a flow's inner stack is always
depth-1 at its first step; e.g. Swap opened from Token Info stays a back
arrow, not a Close).
- Removed the dead startContent/endContent overload (resolves an
overload-ambiguity the signature change surfaced).
Sheet screens (Labs, Token Discovery) collapse to a single AppBarWithTitle
call; ~30 other callers just drop the redundant `backButton = true`.
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.
What
AppBarWithTitlenow derives its leading control from context instead of each sheet screen hand-rollingremember { navigator.backStack.size <= 1 }to choose back-vs-close.onBackIconClicked; thebackButton: Booleanparam is removed (every call site already passed a handler).LocalSheetNavigatorpresent) or a flow that opted intoFlowDismissStyle.Close— and a back arrow (←) otherwise.flowDismissStyle(a flow's inner stack is always depth-1 at its first step; e.g. Swap opened from Token Info stays a back arrow, not a Close).startContent/endContentoverload (resolves an overload-ambiguity the signature change surfaced).Why
We're moving to a tab-bar-centric v2 UI; screens are no longer sheet-centric, so this stops every new sheet screen from re-implementing the back-vs-close branch.
Scope
Sheet screens (Labs, Token Discovery) collapse to a single
AppBarWithTitlecall; ~30 other callers just drop the redundantbackButton = true. Pure refactor — no behavior change for existing non-sheet screens.