Skip to content

refactor(ui): internalize AppBar back-vs-close, drop backButton flag - #1207

Merged
bmc08gt merged 1 commit into
code/cashfrom
refactor/appbar-back-close
Aug 10, 2026
Merged

refactor(ui): internalize AppBar back-vs-close, drop backButton flag#1207
bmc08gt merged 1 commit into
code/cashfrom
refactor/appbar-back-close

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

What

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 to context: a Close (✕) 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).

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 AppBarWithTitle call; ~30 other callers just drop the redundant backButton = true. Pure refactor — no behavior change for existing non-sheet screens.

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`.
@github-actions github-actions Bot added type: refactor Code restructuring, no behavior change area: payments Payments, transfers, intents, billing area: ui Compose UI, theme, components, resources area: onramp Deposit, purchase, Coinbase, fiat on-ramp area: tokens Token accounts, balances, token info area: onboarding labels Aug 10, 2026
@bmc08gt
bmc08gt merged commit f8bcd97 into code/cash Aug 10, 2026
3 of 4 checks passed
@bmc08gt
bmc08gt deleted the refactor/appbar-back-close branch August 10, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: onboarding area: onramp Deposit, purchase, Coinbase, fiat on-ramp area: payments Payments, transfers, intents, billing area: tokens Token accounts, balances, token info area: ui Compose UI, theme, components, resources type: refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant