Skip to content

refactor(ui): rename StreamContextMenuItem to StreamContextMenuAction#56

Merged
xsahil03x merged 2 commits intomain-design-systemfrom
refactor/context-menu
Feb 24, 2026
Merged

refactor(ui): rename StreamContextMenuItem to StreamContextMenuAction#56
xsahil03x merged 2 commits intomain-design-systemfrom
refactor/context-menu

Conversation

@xsahil03x
Copy link
Member

@xsahil03x xsahil03x commented Feb 24, 2026

Summary by CodeRabbit

  • New Features

    • Added dialog-based integration and custom theming support for context menus.
    • Introduced context menu action component with generic value return capabilities.
  • Refactor

    • Renamed context menu components from "Item" to "Action" terminology.
    • Updated design system gallery widget naming conventions.

@xsahil03x xsahil03x requested a review from a team as a code owner February 24, 2026 00:03
@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

This PR refactors the context menu system from a StreamContextMenuItem-based API to a new generic StreamContextMenuAction<T> API. It includes creating the new action component with value support, removing the deprecated item component, updating all theme exports, and migrating the design system gallery to demonstrate action-based workflows including dialog integration and custom theming.

Changes

Cohort / File(s) Summary
Gallery Updates
apps/design_system_gallery/lib/app/gallery_app.directories.g.dart, apps/design_system_gallery/lib/components/context_menu/stream_context_menu.dart
Updated widget names (MessageComposerAttachmentLinkPreview → MessageComposerLinkPreviewAttachment, etc.) and migrated showcase to action-based API with new dialog integration and custom theming sections.
Action Component (New)
packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_action.dart
Introduced StreamContextMenuAction with dual constructors, static helpers for separators/sections, generic value support, Navigator.pop integration for dialog returns, and DefaultStreamContextMenuAction rendering with theming.
Item Component (Removed)
packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_item.dart
Deleted StreamContextMenuItem, StreamContextMenuItemProps, and DefaultStreamContextMenuItem classes along with all item-based rendering logic.
Exports & Component Factory
packages/stream_core_flutter/lib/src/components.dart, packages/stream_core_flutter/lib/src/factory/stream_component_factory.dart, packages/stream_core_flutter/lib/src/factory/stream_component_factory.g.theme.dart
Replaced contextMenuItem export/builder with contextMenuAction; updated factory types from StreamContextMenuItemProps to StreamContextMenuActionProps.
Action Theme System (New)
packages/stream_core_flutter/lib/src/theme/components/stream_context_menu_action_theme.dart, packages/stream_core_flutter/lib/src/theme/components/stream_context_menu_action_theme.g.theme.dart
Added StreamContextMenuActionTheme, StreamContextMenuActionThemeData, and StreamContextMenuActionStyle with WidgetStateProperty-based styling and lerp support.
Item Theme System (Removed)
packages/stream_core_flutter/lib/src/theme/components/stream_context_menu_item_theme.dart
Deleted StreamContextMenuItemTheme, StreamContextMenuItemThemeData, and StreamContextMenuItemStyle classes.
Theme Integration
packages/stream_core_flutter/lib/src/theme.dart, packages/stream_core_flutter/lib/src/theme/stream_theme.dart, packages/stream_core_flutter/lib/src/theme/stream_theme.g.theme.dart, packages/stream_core_flutter/lib/src/theme/stream_theme_extensions.dart
Replaced all contextMenuItemTheme references with contextMenuActionTheme across theme exports, StreamTheme class, generated code, and extensions.
Documentation
packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu.dart, packages/stream_core_flutter/lib/src/theme/components/stream_context_menu_theme.dart
Updated doc comments and code examples to reference StreamContextMenuAction; removed StreamContextMenu.separated factory and added SingleChildScrollView for scrolling support.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Possibly related PRs

Suggested reviewers

  • renefloor

Poem

🐰 Actions bold replace the items old,
With generics new and stories untold,
Dialogs pop with values returned,
Themes refined, fresh lessons learned!
Hopping forward to adventures bright,

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is missing entirely. The template requires a description section, CLA confirmation, testing information, and optional screenshots. Add a comprehensive PR description including: what the refactoring accomplishes, why StreamContextMenuAction is preferred, testing instructions, CLA checkbox confirmation, and any migration notes for users.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main refactoring: renaming StreamContextMenuItem to StreamContextMenuAction across the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/context-menu

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@xsahil03x
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_action.dart (1)

255-266: Consider constraining T to Object instead of Object?.

StreamContextMenuActionProps<T extends Object?> allows T itself to be a nullable type (e.g., StreamContextMenuAction<String?>). Combined with final T? value, the value field then has type String?? which Dart flattens to String?, making it impossible to distinguish "no value provided" from "value is explicitly null." If T extends Object, the nullability of value remains meaningful. This is the same pattern PopupMenuEntry<T> uses in Flutter.

Proposed change
-class StreamContextMenuActionProps<T extends Object?> {
+class StreamContextMenuActionProps<T extends Object> {

And correspondingly on the widget class:

-class StreamContextMenuAction<T> extends StatelessWidget {
+class StreamContextMenuAction<T extends Object> extends StatelessWidget {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_action.dart`
around lines 255 - 266, Change the generic bound from T extends Object? to T
extends Object for StreamContextMenuActionProps and the corresponding widget
class (e.g., StreamContextMenuAction) so that the value field (final T? value)
can represent “no value provided” vs “explicit null” correctly; update any
related declarations and constructors that declare
StreamContextMenuActionProps<T extends Object?> and StreamContextMenuAction<T
extends Object?> to use T extends Object instead, keeping the rest of the API
(value as T?) unchanged.
apps/design_system_gallery/lib/components/context_menu/stream_context_menu.dart (1)

1006-1026: Hardcoded border radius in _ResultChip.

Line 1013 uses BorderRadius.circular(6) while the rest of the gallery consistently uses StreamRadius tokens (e.g., radius.xs, radius.lg). Consider using a stream radius token for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/design_system_gallery/lib/components/context_menu/stream_context_menu.dart`
around lines 1006 - 1026, The _ResultChip widget currently uses a hardcoded
BorderRadius.circular(6); replace that with the design token (e.g., radius.xs)
so the gallery uses StreamRadius tokens consistently—locate
BorderRadius.circular(6) in _ResultChip and change it to use
BorderRadius.circular(radius.xs) (or the appropriate radius token like radius.lg
per visual spec).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/design_system_gallery/lib/components/context_menu/stream_context_menu.dart`:
- Around line 556-613: The onTap handler in _TypedValueReturnCardState awaits
showDialog and then calls setState without checking mounted; update the handler
in the StreamButton onTap (the async closure inside _TypedValueReturnCardState)
to guard the post-await setState with a mounted check (e.g., if (!mounted)
return; or if (mounted) setState(...)) so you only update _result when the State
is still active; apply the same mounted-guard fix to the analogous async onTap
in _EnumValueReturnCardState that sets state after awaiting showDialog.

---

Nitpick comments:
In
`@apps/design_system_gallery/lib/components/context_menu/stream_context_menu.dart`:
- Around line 1006-1026: The _ResultChip widget currently uses a hardcoded
BorderRadius.circular(6); replace that with the design token (e.g., radius.xs)
so the gallery uses StreamRadius tokens consistently—locate
BorderRadius.circular(6) in _ResultChip and change it to use
BorderRadius.circular(radius.xs) (or the appropriate radius token like radius.lg
per visual spec).

In
`@packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_action.dart`:
- Around line 255-266: Change the generic bound from T extends Object? to T
extends Object for StreamContextMenuActionProps and the corresponding widget
class (e.g., StreamContextMenuAction) so that the value field (final T? value)
can represent “no value provided” vs “explicit null” correctly; update any
related declarations and constructors that declare
StreamContextMenuActionProps<T extends Object?> and StreamContextMenuAction<T
extends Object?> to use T extends Object instead, keeping the rest of the API
(value as T?) unchanged.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between aa5d032 and c7ec8a2.

📒 Files selected for processing (16)
  • apps/design_system_gallery/lib/app/gallery_app.directories.g.dart
  • apps/design_system_gallery/lib/components/context_menu/stream_context_menu.dart
  • packages/stream_core_flutter/lib/src/components.dart
  • packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu.dart
  • packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_action.dart
  • packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_item.dart
  • packages/stream_core_flutter/lib/src/factory/stream_component_factory.dart
  • packages/stream_core_flutter/lib/src/factory/stream_component_factory.g.theme.dart
  • packages/stream_core_flutter/lib/src/theme.dart
  • packages/stream_core_flutter/lib/src/theme/components/stream_context_menu_action_theme.dart
  • packages/stream_core_flutter/lib/src/theme/components/stream_context_menu_action_theme.g.theme.dart
  • packages/stream_core_flutter/lib/src/theme/components/stream_context_menu_item_theme.dart
  • packages/stream_core_flutter/lib/src/theme/components/stream_context_menu_theme.dart
  • packages/stream_core_flutter/lib/src/theme/stream_theme.dart
  • packages/stream_core_flutter/lib/src/theme/stream_theme.g.theme.dart
  • packages/stream_core_flutter/lib/src/theme/stream_theme_extensions.dart
💤 Files with no reviewable changes (2)
  • packages/stream_core_flutter/lib/src/components/context_menu/stream_context_menu_item.dart
  • packages/stream_core_flutter/lib/src/theme/components/stream_context_menu_item_theme.dart

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 1.05263% with 94 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main-design-system@aa5d032). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...nents/context_menu/stream_context_menu_action.dart 0.00% 76 Missing ⚠️
...e/components/stream_context_menu_action_theme.dart 7.14% 13 Missing ⚠️
...c/components/context_menu/stream_context_menu.dart 0.00% 3 Missing ⚠️
...tream_core_flutter/lib/src/theme/stream_theme.dart 0.00% 1 Missing ⚠️
...flutter/lib/src/theme/stream_theme_extensions.dart 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (1.05%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@                  Coverage Diff                  @@
##             main-design-system      #56   +/-   ##
=====================================================
  Coverage                      ?   32.99%           
=====================================================
  Files                         ?      101           
  Lines                         ?     3043           
  Branches                      ?        0           
=====================================================
  Hits                          ?     1004           
  Misses                        ?     2039           
  Partials                      ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xsahil03x xsahil03x merged commit 5b95b48 into main-design-system Feb 24, 2026
3 of 4 checks passed
@xsahil03x xsahil03x deleted the refactor/context-menu branch February 24, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants