fix(demo): keep back stack after wallet creation; spendable Home balance with pending activity card - #127
Conversation
…tate and native resource disposal
…from widget tests
…transaction-history
Johnosezele
left a comment
There was a problem hiding this comment.
@Shamsudeen12 you have 16 unrelated commits here, pls rebase your own commits onto main and force-push, also make sure to sign your commits. Thanks!
@Johnosezele The unrelated commits are because the PR depends on #102. I can wait until that gets merged and then rebase on main, but the related commits are just the last two |
Home previously displayed wallet.balance().total as the hero figure, so an unconfirmed incoming transaction inflated the balance while Trusted spendable stayed at 0. - Drive the hero balance from trustedSpendableSat; show a "Total incl. pending" subtitle only when total differs from spendable - Add a pending activity card below Send/Receive while the balance snapshot has trusted/untrusted pending funds: summed pending amount, up to three pending transaction rows opening Transaction Detail, and a View all link into Transaction History - Keep card visibility snapshot-driven so it clears as soon as a post-confirmation sync applies the fresh balance - Add a pendingSat getter on WalletBalanceSnapshot and a @VisibleForTesting applySnapshot seam on BalanceSnapshotNotifier - Cover untrusted-pending-only, no-pending, clear-after-sync, row-cap, and unit-toggle cases in home_page_test Closes bitcoindevkit#119
763a112 to
2a2a5f7
Compare
|
@Shamsudeen12 tACK 2a2a5f7 on Linux. Tested the changes locally the pending card on Home and the spendable hero balance work as expected, and pressing back after wallet creation now properly returns to the active wallets list instead of exiting the app. All demo tests passed on my end. |
fix(demo): keep back stack after wallet creation; show spendable Home balance with pending activity card
Summary
Two
bdk_demofixes:bug: Android back button closes demo app after wallet creation #122 — Android back button closes the app after wallet creation.
CreateWalletPagenavigated home withcontext.go, which rewrites the navigation stack, so the system back button had nowhere to pop to and exited the app (while the AppBar arrow worked). Switched tocontext.replace, which swaps only the current entry and keeps the underlying back stack — system back now behaves like the arrow icon.bdk_demo: Home shows pending funds as balance; add pending tx summary under Send/Receive #119 — Home shows pending funds as the balance. An unconfirmed incoming transaction bumped the hero Balance (wired to BDK
total) even while Trusted spendable read0. The hero now showstrustedSpendable(confirmed + trusted pending — what can actually be spent), and pending activity gets its own surface below Send/Receive.Changes for #119
trustedSpendableSat. ATotal incl. pending: Xsubtitle appears only when total differs from spendable, so a fully-confirmed wallet shows a single unambiguous figure.WalletStatusChip), each opening Transaction Detail,View all (N)link into Transaction History when there are more.SyncControllerapplies a fresh snapshot synchronously at sync completion, the card clears the moment a post-confirmation sync lands — no stale pending UI. Rows background-refresh after every sync via the transactions controller's existingactiveWalletProviderlistener; no new plumbing.immatureSat(coinbase maturation) is deliberately excluded from the card — it isn't mempool-pending and no sync will confirm it soon; it still surfaces via theTotal incl. pendingsubtitle.pendingSatgetter onWalletBalanceSnapshot, and a@visibleForTesting applySnapshotseam onBalanceSnapshotNotifier(widget tests previously had no way to seed non-zero pending values, since they use real zero-balance wallets).Screenshots
#119 — unconfirmed receive:

Acceptance criteria (#119)
0(spendable semantics).Testing
flutter analyze: clean.flutter test: full suite green.test/presentation/home_page_test.dart: untrusted-pending-only snapshot (hero0, card showing+25000 sat), card hidden with no pending, card clears after confirmation + sync, three-row cap withView all (4), and unit-toggle propagation. Row-tap navigation reuses the samepushNamed('transactionDetail')call already covered by the transactions list tests.Known limitation (accepted)
A full-sweep outgoing tx (no change output) leaves every pending bucket at
0while a pending transaction exists, so the card stays hidden; the tx remains visible on the Transactions page. Cost of the single-source-of-truth visibility rule — a one-line change if we'd rather show it.Closes #122
Closes #119