Skip to content

feat(ui): add StreamContextMenuAnchor - #226

Open
renefloor wants to merge 6 commits into
feat/stream-modal-dialogfrom
feat/stream-context-menu-anchor
Open

renefloor wants to merge 6 commits into
feat/stream-modal-dialogfrom
feat/stream-context-menu-anchor

Conversation

@renefloor

@renefloor renefloor commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked PR (stack #232: #225 → #226 → #227 → #229). This PR targets #225 (feat/stream-modal-dialog), so it merges after #225.

What

  • StreamContextMenuAnchor: wraps MenuAnchor so a StreamContextMenu supplies the whole surface. It neutralizes the MenuAnchor panel (StreamContextMenuAnchor.menuStyle), turns off the panel clip (Clip.none) so the menu shadow isn't cut off, keeps the menu's scroll view off the PrimaryScrollController, bounds the panel with constraints, and sizes rows to the design's denser Web / Menu Item (32px rows, 200px minimum width, caption/emphasis labels, 16px icons). (Figma)

  • StreamContextMenuAnchorTheme / StreamContextMenuAnchorThemeData: constraints, alignmentOffset and actionStyle (a StreamContextMenuActionStyle merged over the design row). The theme is available as StreamTheme.contextMenuAnchorTheme and context.streamContextMenuAnchorTheme. A widget param wins over the theme, and the theme wins over the defaults.

    • There is no elevation on the anchor theme. StreamContextMenuStyle.elevation in StreamContextMenuTheme already covers it for anchored and inline menus, so the anchor's elevation param passes straight to StreamContextMenu. A test covers that path.
  • Public statics kept: defaultConstraints, menuStyle and defaultActionStyle(BuildContext). defaultActionStyle now returns the design row with the theme's actionStyle merged over it. StreamContextMenuActionTheme.of only reads the nearest theme, so a caller that re-wraps a single row (as StreamAdaptiveMenuAnchor does for its selected row) keeps the theme's values instead of quietly dropping them.

  • Factory hook: StreamComponentBuilders.contextMenuAnchor with StreamContextMenuAnchorProps / DefaultStreamContextMenuAnchor. Apps use the anchor directly, not as a building block inside another component, so it gets a hook. That lets an integrator replace how menus are presented everywhere, for example with a sheet or a native menu.

  • Gallery: [Components]/Context Menu/StreamContextMenuAnchor Playground (knobs for item count, long labels, destructive section, elevation, alignment offset, max width/height, row height) and Showcase (default, flat, long labels, scrolling, themed).

  • Barrel: video.dart (experimental), next to StreamSplitButton. The classes are marked @experimental.

  • Headings: StreamContextMenuAnchorThemeData.headingStyle and StreamContextMenuAnchor.defaultHeadingStyle(context) give a StreamContextMenuHeading in an anchored menu the Web Menu Heading values (captionEmphasis, 16px icon, radius.md), merged with the heading theme and then the anchor theme the same way as defaultActionStyle. The menu is wrapped in a StreamContextMenuHeadingTheme next to the action theme; the heading's row size and padding still come from the anchored rows.

  • Focus ring: StreamContextMenuActionStyle gets a side, and the action defaults draw a 2px borderFocus ring there when the row is focused. Inline menus get the ring too, and a themed shape keeps its border: unfocused rows leave side null. The anchor's default only sets the radius.md shape.

Figma

Why

This graduates the design-system candidate from stream-video-flutter, so the SDK can delete its copy and import this one. Source on v2: stream_context_menu_anchor.dart, introduced in GetStream/stream-video-flutter#1311 and changed in #1320, #1332 and #1458.

API changes compared with the candidate:

  • constraints and alignmentOffset are now nullable, so the theme can supply them. Leaving them out still resolves to defaultConstraints / Offset.zero, and passing a value works as before.
  • The constructor is no longer const, because it builds props for the factory, as every factory-backed component does. The candidate's own callers never build it as const.
  • Fields now live on props (anchor.props.constraints rather than anchor.constraints).
  • The examples are generic instead of call-specific.

Differs from v2: Escape inside a dialog

In v2, pressing Escape with a menu open inside a dialog closed the menu and the dialog together, because a menu opened by a tap left focus on the dialog's route. The anchor now takes focus when its menu opens, so Escape closes only the menu. A second Escape still closes the dialog. Covered by StreamContextMenuAnchor in a dialog closes only the menu on Escape.

Verified

  • melos bootstrap, melos run generate:flutter (regenerated stream_theme, the component factory and the gallery directories).
  • melos run format:verify, melos run analyze (no issues), melos run check:barrels, melos run check:tokens: all pass.
  • flutter test --exclude-tags golden in stream_core_flutter: all 1057 tests pass after rebasing on feat(ui): add StreamModalDialog #225 and main, including the anchor and theme tests and new ones for anchored headings and a themed shape's border. The candidate's three tests are ported without StreamSelectInput and StreamRadioIndicator. Two regression tests cover the shadow clip and the scroll controller: one checks Clip.none, the other opens a scrolling menu on iOS. Both fail when their fix is reverted.
  • dart analyze --fatal-infos in apps/design_system_gallery: no issues. I have not clicked through it in the running gallery.
  • Goldens (stream_context_menu_anchor_{light,dark,long_label,flat}) render the open menu inside a scenario-local Overlay, so the panel lands in the captured area. I checked the local macOS output by eye. goldens/ci/ still needs the update_goldens workflow dispatched on this branch.

🤖 Generated with Claude Code

participant_tile_options_menu_dark participant_tile_options_menu_light

@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.54839% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.72%. Comparing base (94fea35) to head (219a958).

Files with missing lines Patch % Lines
...e/components/stream_context_menu_anchor_theme.dart 63.63% 4 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                      @@
##           feat/stream-modal-dialog     #226      +/-   ##
============================================================
+ Coverage                     73.49%   73.72%   +0.23%     
============================================================
  Files                           224      226       +2     
  Lines                          9641     9703      +62     
============================================================
+ Hits                           7086     7154      +68     
+ Misses                         2555     2549       -6     

☔ View full report in Codecov by Harness.
📢 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.

@renefloor
renefloor added this pull request to stack #228 November 10, 2026 13:39
@renefloor
renefloor removed this pull request from stack #228 November 10, 2026 15:28
@renefloor
renefloor changed the base branch from main to feat/stream-modal-dialog November 10, 2026 15:28
@renefloor
renefloor added this pull request to stack #232 November 10, 2026 15:28
@renefloor
renefloor force-pushed the feat/stream-context-menu-anchor branch from a58f847 to 257d7f5 Compare November 24, 2026 14:24
@renefloor
renefloor marked this pull request as ready for review November 24, 2026 14:30
@renefloor
renefloor requested a review from a team as a code owner November 24, 2026 14:30
@renefloor renefloor added the ready Pull request ready to be reviewed label Nov 24, 2026
@renefloor

Copy link
Copy Markdown
Collaborator Author

/jeffery review

@renefloor
renefloor force-pushed the feat/stream-context-menu-anchor branch from 638e78b to 9479cd3 Compare November 24, 2026 14:33
@getstream-metis

Copy link
Copy Markdown

Thanks for asking Jeffery for review. I'll stay on this PR until I can approve it.

How it works

  • Findings come as inline comments, each starting with [Must Fix], [Should Fix], nit: or consider:.
  • Push fixes whenever you're ready. Once the branch has been quiet for 10 minutes I review the new head and resolve the threads it fixes. To skip the wait, comment /jeffery review.
  • If you disagree or have a question, reply in the thread. I'll answer there, and resolve it if you're right.
  • I approve once every must-fix and should-fix is closed and nobody has requested changes. CI isn't part of that; branch protection still holds the merge until it's green. From round 3 on, open should-fix findings stop blocking.
  • I don't approve release/* branches or changes to protected paths, and I'll say so when that applies.
  • If a must-fix is still open after round 8, I stop and hand the PR to a human. Draft PRs wait until they're marked ready.

Commands (each as a whole comment)

Command What it does
/jeffery review Review the current head now
/jeffery rereview Start over at round 1 on the current head and withdraw my approval. This redoes the whole review and costs as much as the first one, so use it only when you don't trust the earlier rounds. If nothing changed since my last round I say so instead; add force to redo it anyway
/jeffery pause / /jeffery resume Stop or restart automatic reviews on this PR
/jeffery status What I last reviewed, and why I have or haven't approved
/jeffery help This list

/review-agent or a mention of me works in place of /jeffery.

@getstream-metis getstream-metis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Round 1 on 9479cd390221 · 🆕 1 new

getstream-metis[bot]
getstream-metis Bot previously approved these changes Nov 24, 2026

@getstream-metis getstream-metis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Approved 9479cd390221 after 1 round

Left open, your call:

@xsahil03x xsahil03x left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Superseded by the inline review: #226 (review)

@github-actions github-actions Bot added pending Review comments waiting to be addressed and removed ready Pull request ready to be reviewed labels Nov 25, 2026

@xsahil03x xsahil03x left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed against the style guide, Flutter's MenuAnchor / RawMenuAnchor, and Figma 1935:50496 (Web Menu Item). Anyone who knows MenuAnchor can pick this up: the controller, open(position:), the builder signature, alignmentOffset, onOpen/onClose, Esc and RTL all carry over. Row height, width, icons, gap, radius and colours match Figma. Since this is stacked on #225, the route fixes there come first.

Design questions (for the designers)

  • Figma's Menu Item has a State=Selected (background/utility/selected), a showDescription shortcut slot, and showLeadingSpace for label alignment. None of these exist in code. Which do we need?
  • Is there a menu container spec? I couldn't find one, so panel padding, elevation and border are unverified. The row's 4 + 8 inset only matches the code if the panel has 0 padding.
  • Figma rows are drawn 360 wide; the code caps the panel at 320 (:81). Is there a real max width?

@getstream-metis
getstream-metis Bot dismissed their stale review November 25, 2026 12:24

Withdrawing approval until a142a67 is reviewed.

@getstream-metis getstream-metis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Round 2 on a142a670635e · 🆕 2 new

getstream-metis[bot]
getstream-metis Bot previously approved these changes Nov 25, 2026

@getstream-metis getstream-metis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Approved a142a670635e after 2 rounds · 1 fixed

Left open, your call:

@renefloor
renefloor force-pushed the feat/stream-context-menu-anchor branch from a142a67 to 54d4150 Compare November 25, 2026 12:39
@getstream-metis
getstream-metis Bot dismissed their stale review November 25, 2026 12:40

Withdrawing approval until 54d4150 is reviewed.

getstream-metis[bot]
getstream-metis Bot previously approved these changes Nov 25, 2026

@getstream-metis getstream-metis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Approved 54d415012e3b after 3 rounds · 1 fixed

Left open, your call:

@renefloor renefloor added ready Pull request ready to be reviewed and removed pending Review comments waiting to be addressed labels Nov 25, 2026

@xsahil03x xsahil03x left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Follow-up round: I checked the patterns we raised on #221 (focus theming, effective* locals, .from, factory generics, animation parity, trailing commas) across the remaining PRs. One finding here.

@github-actions github-actions Bot added pending Review comments waiting to be addressed and removed ready Pull request ready to be reviewed labels Nov 25, 2026
@getstream-metis
getstream-metis Bot dismissed their stale review November 26, 2026 12:55

Withdrawing approval until b40f4fa is reviewed.

@renefloor renefloor added ready Pull request ready to be reviewed and removed pending Review comments waiting to be addressed labels Nov 26, 2026
@renefloor
renefloor force-pushed the feat/stream-context-menu-anchor branch 2 times, most recently from 820d561 to 62161f7 Compare November 26, 2026 13:07

@getstream-metis getstream-metis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Round 4 on 62161f703201 · 🆕 1 new

getstream-metis[bot]
getstream-metis Bot previously approved these changes Nov 26, 2026

@getstream-metis getstream-metis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Approved 62161f703201 after 4 rounds · 3 fixed

Left open, your call:

@renefloor
renefloor force-pushed the feat/stream-context-menu-anchor branch from 62161f7 to f94312f Compare December 1, 2026 11:07
@getstream-metis
getstream-metis Bot dismissed their stale review December 1, 2026 11:07

Withdrawing approval until f94312f is reviewed.

getstream-metis[bot]
getstream-metis Bot previously approved these changes Dec 1, 2026

@getstream-metis getstream-metis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Round 5 · ✅ 4 fixed · 🎉 Approved

Nice work, Rene! Nothing blocking is left on ec0621c730d2. Ship it 🚀

@xsahil03x xsahil03x left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All fixed, thanks. The focus ring and the anchored heading metrics look good. Merge after #225; the rebase should only touch the Escape-in-a-dialog test if child becomes content.

@github-actions github-actions Bot added approved Approved by a reviewer and removed ready Pull request ready to be reviewed labels Dec 1, 2026
renefloor and others added 5 commits December 1, 2026 13:41
Graduates the context menu anchor from stream-video-flutter into the
experimental video.dart barrel, with StreamContextMenuAnchorTheme on
StreamTheme and a contextMenuAnchor factory hook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…its in a dialog

A menu opened by a tap left focus on the enclosing route, so Escape reached the
route's DismissAction and popped the dialog along with the menu. The anchor now
takes focus when the menu opens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to the screen

- Add `side` to `StreamContextMenuActionStyle`; the action defaults draw the
  focus ring there, so a themed `shape` keeps it and inline menus get it too.
- Keep the anchor's fallback `Focus` in the tree whatever `childFocusNode` is,
  so switching it does not remount the builder.
- Cap the anchored menu at the height `reservedPadding` leaves, so the menu
  scrolls its rows instead of the panel scrolling the whole menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds headingStyle to StreamContextMenuAnchorThemeData and
StreamContextMenuAnchor.defaultHeadingStyle, and wraps the menu in a
StreamContextMenuHeadingTheme, so a heading shows caption text, a 16px icon
and the md radius next to the 32px rows. An unfocused action row now keeps
the border of a themed shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@renefloor
renefloor force-pushed the feat/stream-context-menu-anchor branch from ec0621c to 415920b Compare December 1, 2026 12:42
@getstream-metis
getstream-metis Bot dismissed their stale review December 1, 2026 12:42

Withdrawing approval until 415920b is reviewed.

@getstream-metis getstream-metis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Round 6 · ✅ 4 fixed · 🎉 Approved

Nice work, Rene! Nothing blocking is left on 199c0ed9d329. Ship it 🚀

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Approved by a reviewer jeffery:review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants