Skip to content

feat(buddies): favorite a buddy from the Dive Partners list and detail page - #2146

Merged
ericgriffin merged 4 commits into
submersion-app:mainfrom
alpheios-one:github-issue-1336-buddy-favorite-partner-page
Sep 19, 2026
Merged

ericgriffin merged 4 commits into
submersion-app:mainfrom
alpheios-one:github-issue-1336-buddy-favorite-partner-page

Conversation

@alpheios-one

Copy link
Copy Markdown
Collaborator

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).

  • Favorite-star toggle in all three buddy list tiles (detailed/compact/dense) and on the buddy detail page (app bar for the standalone page, embedded header for master-detail).
  • Favorites are pinned to the top of the Dive Partners list regardless of the chosen sort field, matching the picker sheet's existing behavior. Table mode keeps its own column-driven sort and is intentionally excluded (tested).
  • Extracts a shared BuddyFavoriteButton widget 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.
  • Splits 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

  • New/updated unit and widget tests for the favorite toggle, the pinning logic, and the extracted widgets (flutter test test/features/buddies/, 429 tests passing)
  • dart format / flutter analyze clean
  • Manually verified in a debug build: favoriting from the list and from the detail page, pinning order, table mode unaffected

Closes #1336

…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.
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build artifacts for this PR · commit b9a03c6

Platform Download
Android (APK) android-apk
macOS macos-build
Windows windows-build
Linux linux-build

Artifacts expire in 7 days. Downloading requires being signed in to GitHub. macOS needs two extractions: unzip the downloaded artifact, then unzip the submersion-macos.zip inside it to get a runnable submersion.app. The build is ad-hoc signed — right-click → Open on first launch.

Updated automatically on each push.

@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.56627% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...eatures/buddies/presentation/buddy_dive_share.dart 76.92% 9 Missing ⚠️
...esentation/widgets/buddy_shared_dives_section.dart 94.11% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ericgriffin
ericgriffin requested a lite review from Copilot September 19, 2026 01:04
@ericgriffin ericgriffin added the enhancement New feature or request label Sep 19, 2026
@ericgriffin ericgriffin moved this from Backlog to In review in Submersion Release Tracker Sep 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Medium severity

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.

Comment thread lib/features/buddies/presentation/widgets/buddy_shared_dives_section.dart Outdated
…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.
@ericgriffin

Copy link
Copy Markdown
Member

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:

Platform Before After Dense row height
Android / iOS 40x40 48x48 60 to 68 px
macOS / Windows / Linux 32x24 32x32 44 to 52 px

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).

@alpheios-one

Copy link
Copy Markdown
Collaborator Author

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.

@ericgriffin
ericgriffin merged commit f74cff5 into submersion-app:main Sep 19, 2026
36 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Submersion Release Tracker Sep 19, 2026
@alpheios-one
alpheios-one deleted the github-issue-1336-buddy-favorite-partner-page branch September 19, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Diving partner / Diver – Add to favourites

3 participants