feat(buddies): favorite a buddy from the Dive Partners list and detail page - #2146
Conversation
…l page Refs submersion-app#1336 - Star toggle in all three buddy-list tiles (detailed/compact/dense) and in the buddy detail page (app bar and embedded header), reusing the existing toggleFavorite repository/provider wiring from the "Add buddy" picker sheet (issue submersion-app#638). - Favorites are pinned to the top of the Dive Partners list regardless of the chosen sort field, matching the picker sheet. The table view keeps its own column-driven sort and is left untouched. - Extracts the favorites-partitioning logic shared by the picker sheet and the main list into pinFavoriteBuddiesToTop().
…arget Refs submersion-app#1336 Code review found the favorite-star markup copy-pasted across six call sites, and the dense/compact tiles shrinking the button's tap target to 16-18px (padding: zero, empty BoxConstraints), which let a near-miss tap fall through to the row's own navigation. - Extracts BuddyFavoriteButton with an explicit 32x32 tap-target floor, used by all three list tiles, the detail page (app bar + embedded header), and the pre-existing "Add buddy" picker sheet. - DenseBuddyListTile no longer needs a Riverpod ref, so it reverts to StatelessWidget.
…ddy_detail_page Refs submersion-app#1336 buddy_detail_page.dart was already over CLAUDE.md's 800-line guideline before this PR (874 lines); extracts the two largest self-contained chunks so it settles well under it (602 lines): - BuddySharedDivesSection: the shared-dives card, now its own widget - shareDivesWithBuddy: the UDDF export flow, pure logic with no page state, moved to a top-level function Pure refactor, no behavior change.
|
📦 Build artifacts for this PR · commit
Artifacts expire in 7 days. Downloading requires being signed in to GitHub. macOS needs two extractions: unzip the downloaded artifact, then unzip the Updated automatically on each push. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Address the favorite button hit target and imperial depth formatting issues.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Adds buddy favorites to list tiles, picker/detail views, and pins favorites in non-table lists while extracting shared detail-page widgets.
Changes:
- Adds reusable favorite controls and favorite-aware sorting.
- Adds coverage for toggles, ordering, and detail views.
- Extracts shared-dives and export logic.
| File | Summary |
|---|---|
test/features/buddies/presentation/widgets/dense_buddy_list_tile_test.dart |
Tests dense-tile favorites. |
test/features/buddies/presentation/widgets/compact_buddy_list_tile_test.dart |
Tests compact-tile favorites. |
test/features/buddies/presentation/widgets/buddy_list_tile_test.dart |
Tests detailed-tile favorites. |
test/features/buddies/presentation/widgets/buddy_list_content_test.dart |
Tests favorite ordering and table behavior. |
test/features/buddies/presentation/providers/buddy_providers_test.dart |
Tests favorite partitioning and sorting. |
test/features/buddies/presentation/pages/buddy_detail_page_test.dart |
Tests detail-page favorites. |
test/features/buddies/helpers/fake_buddy_list_notifier.dart |
Adds a test notifier. |
lib/features/buddies/presentation/widgets/dense_buddy_list_tile.dart |
Adds the dense-tile favorite control. |
lib/features/buddies/presentation/widgets/compact_buddy_list_tile.dart |
Adds the compact-tile favorite control. |
lib/features/buddies/presentation/widgets/buddy_shared_dives_section.dart |
Extracts the shared-dives card; depth formatting needs correction for imperial units. |
lib/features/buddies/presentation/widgets/buddy_picker.dart |
Reuses the shared favorite control. |
lib/features/buddies/presentation/widgets/buddy_list_tile.dart |
Adds the detailed-tile favorite control. |
lib/features/buddies/presentation/widgets/buddy_list_content.dart |
Pins favorites in supported list modes. |
lib/features/buddies/presentation/widgets/buddy_favorite_button.dart |
Adds the shared favorite control; its hit box should use the 48×48 minimum target. |
lib/features/buddies/presentation/providers/buddy_providers.dart |
Adds favorite partitioning and sorting. |
lib/features/buddies/presentation/pages/buddy_detail_page.dart |
Integrates detail favorites and extracted widgets. |
lib/features/buddies/presentation/buddy_dive_share.dart |
Extracts dive-export logic. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…on touch Refs submersion-app#1336 Review follow-ups on the favorite-buddy work: - The shared-dives card appended a literal "m" to the stored meter value, so an imperial diver saw a metric number labelled as meters. It now uses UnitFormatter.formatDepth, like the rest of the card's formatting. The bug predates the split out of buddy_detail_page; the move carried it along. - BuddyFavoriteButton's VisualDensity.compact subtracted 8 from both the 32x32 floor and the padded touch target, leaving a 40x40 hit box on touch platforms and 32x24 on desktop. Dropping it gives the 48x48 Material minimum on touch and a true 32x32 on pointer-driven desktop, where a 48x48 box would grow each dense row from 44 to 68 px.
|
On the review summary's other point, that `BuddyFavoriteButton`'s hit box should use the 48x48 minimum (no inline thread for this one), fixed in b9a03c6. Measured before the change, `VisualDensity.compact` subtracted 8 from both the 32x32 floor and the padded touch target, so the star was actually 40x40 on touch platforms and 32x24 on desktop, not the 32x32 the doc comment described. The fix drops the compact density:
Desktop deliberately stays at 32x32 rather than 48x48: pointer input is precise there, and a 48x48 floor would grow every dense buddy row from 44 to 68 px (+55%). The new `buddy_favorite_button_test.dart` pins both sizes on two platforms each, and the full `test/features/buddies/` suite passes (432 tests). |
|
Thanks for jumping in and fixing both the depth-unit bug and the touch-target sizing directly, Eric — much appreciated. Pulled your commit in cleanly (fast-forward, no conflicts) and resolved the thread. All checks are green on my end; looks ready to merge whenever you are. |

Summary
Adds the ability to favorite a buddy directly from the Dive Partners list and the buddy detail page, extending the favorite/sort functionality added to the "Add buddy" picker sheet in #1237 (issue #638).
BuddyFavoriteButtonwidget used by all five new call sites plus the pre-existing picker sheet, replacing near-duplicate markup and fixing a too-small tap target that a code review caught in the dense/compact tiles.buddy_detail_page.dart's shared-dives card and dive-export logic into their own files (pure refactor, no behavior change) to bring the file back under the project's 800-line guideline.Test plan
flutter test test/features/buddies/, 429 tests passing)dart format/flutter analyzecleanCloses #1336