refactor: unify contact number actions into a single source of truth#1410
Merged
Conversation
The inline actions bar and the popup menu each maintained their own hardcoded list of contact actions, so the same action (audio/video call, history, view contact) appeared in both surfaces at once, with diverging labels (History vs View call history, Contact vs View Contact). The More button reopened the full menu, repeating everything already in the bar. Introduce NumberAction plus a single buildNumberActions builder that both surfaces derive from: the inline bar renders the primary actions, the More menu shows only the rest, and long press still exposes the full set on a collapsed row. ContactPhoneTile now builds its overflow menu from the same builder instead of its own hardcoded entries.
The trailing dial button is a static call shortcut that stays visible in both states. When the tile is expanded, drop the inline call action of the same kind as the dial button (audio or video) so the actions bar no longer repeats it.
26802eb to
c80e465
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors contact/phone-number action handling into a shared model so that inline action bars and popup menus stay consistent (labels, ordering, and duplication behavior) across call tiles and contact phone tiles.
Changes:
- Introduces
NumberAction,buildNumberActions, andnumberActionsToMenuas a single source of truth for number-related actions. - Updates
CallTileto derive inline actions fromprimaryactions and show a true overflow-only More menu (with long-press still showing the full menu). - Updates
ContactPhoneTileto build its overflow menu from the shared builder and aligns tests with the new semantics and labels.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/widgets/call/call_tile_test.dart | Adds coverage for dial-button duplication suppression, overflow-only More behavior, and long-press full menu. |
| test/features/contacts/widgets/contact_tile_test.dart | Updates expanded-tile expectations to reflect More hiding when no overflow actions exist. |
| test/features/contact/widgets/contact_phone_tile_adapter_test.dart | Updates expectations for the consolidated “History” label. |
| lib/widgets/call/number_actions.dart | Adds shared NumberAction model and builders for action lists and popup menu entries. |
| lib/widgets/call/call.dart | Exports number_actions.dart alongside call widgets. |
| lib/widgets/call/call_tile.dart | Refactors action bar and menus to use the shared action model and overflow-only More menu. |
| lib/features/contact/widgets/contact_phone_tile.dart | Replaces hardcoded popup entries with shared number-actions builder/menu conversion. |
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.
Overview
The contact action surfaces each kept their own hardcoded list of actions, so the same action was offered twice at once with inconsistent wording:
ContactPhoneTile(contact details) maintained a third, separate popup builder with the same actions yet again.Changes
NumberActionplus a singlebuildNumberActionsbuilder (lib/widgets/call/number_actions.dart) as the one source of truth for the set, labels, icons and ordering of contact actions. Each action carries aprimaryflag.CallTilenow derives both surfaces from that model:ContactPhoneTilebuilds its overflow menu from the same builder instead of its own hardcoded entries; inline call/video/message icons and the favorite / initiated-transfer affordances are unchanged.Messaging/chat behavior is intentionally left as-is.
Testing
flutter analyzeclean.flutter test- full suite green (updatedcall_tile,contact_tile,contact_phone_tile_adaptertests for the new overflow semantics; added coverage for long-press = full menu and More-hidden-without-overflow).Out of scope
keypad/widgets/actionpad.dartstill has its own popup builder - a candidate to migrate onto the same model later.