Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feat/stream-context-menu-anchor #227 +/- ##
===================================================================
+ Coverage 73.72% 76.04% +2.31%
===================================================================
Files 226 232 +6
Lines 9703 10098 +395
===================================================================
+ Hits 7154 7679 +525
+ Misses 2549 2419 -130 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
c8f323c to
6292324
Compare
df8227d to
b0c1de7
Compare
6b3f627 to
6bc5028
Compare
👋 Thanks, Rene! I'm on it.How to work with me
CommandsComment any of these on the PR:
|
|
/jeffery review |
There was a problem hiding this comment.
🎉 Approved · round 1
Nice work, Rene! Nothing blocking is left on d69b805e46ff. Ship it 🚀
Left open, your call:
- consider: Public enum may need new members later (
packages/stream_core_flutter/lib/src/components/context_menu/stream_adaptive_menu_anchor.dart:28) - consider: Open sheet breaks when its anchor is removed (
packages/stream_core_flutter/lib/src/components/context_menu/stream_adaptive_menu_anchor.dart:416)
Graduates the adaptive menu anchor from stream-video-flutter into the experimental video.dart barrel, with StreamAdaptiveMenuAnchorTheme on StreamTheme and an adaptiveMenuAnchor factory hook. Section headings in the anchored menu take their metrics from the menu's rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows that are a choice now lead with a decorative sm StreamRadioButton. Since it adds no semantics, the anchored row announces its selected state itself, as the sheet's list tile already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and anchor APIs Anchored headings now take the Web heading style from StreamContextMenuAnchor and their row size from its rows, so the menu only layers menuHeadingStyle on top. menuHeadingStyle and sheetHeadingStyle are StreamContextMenuHeadingStyles, choice rows lead with a StreamRadioIndicator, and collapsible headings pass isExpanded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d69b805 to
ce2fd5a
Compare
Withdrawing approval until ce2fd5a is reviewed.
xsahil03x
left a comment
There was a problem hiding this comment.
A few more from checking against Figma and Flutter's menu APIs.
| Widget? _leadingOf(StreamMenuOption option) { | ||
| if (option.leading case final leading?) return leading; | ||
| if (option.selected case final selected?) { | ||
| return StreamRadioIndicator(selected: selected, size: StreamRadioButtonSize.sm); |
There was a problem hiding this comment.
In the sheet, use StreamRadioButtonSize.md (20). The mobile row's icon slot is 20px, the same as its leading icons, so sm (16) looks small there. Keep sm in the anchored menu, where the slot is 16.
There was a problem hiding this comment.
Done in d25564c: sheet radios use StreamRadioButtonSize.md (20), and the anchored menu keeps sm (16). There is a test for each size.
| /// True for a choice, which is answered once the choice is made. False for a | ||
| /// row that reports state the menu is showing — a toggle whose `On` the user | ||
| /// has just pressed for, and should see change. | ||
| final bool closesMenu; |
There was a problem hiding this comment.
Name this closeOnActivate, as on MenuItemButton and on StreamContextMenuAction (#226), which this row maps onto.
There was a problem hiding this comment.
Renamed to closeOnActivate in d25564c, along with its docs, tests and the gallery.
| /// a group, say — sets neither. | ||
| @immutable | ||
| @experimental | ||
| class StreamMenuOption { |
There was a problem hiding this comment.
Nit: consider StreamMenuEntry, after DropdownMenuEntry, which is Flutter's closest equivalent: a data entry rendered by the menu rather than a widget.
There was a problem hiding this comment.
Renamed to StreamMenuEntry in d25564c. StreamMenuSection.options is now entries to match. It is still @experimental.
There was a problem hiding this comment.
Round 2 · 🎉 Approved
Nice work, Rene! Nothing blocking is left on 9021eede3a4a. Ship it 🚀
Left open, your call:
- consider: Public enum may need new members later (
packages/stream_core_flutter/lib/src/components/context_menu/stream_adaptive_menu_anchor.dart:28) - consider: Open sheet breaks when its anchor is removed (
packages/stream_core_flutter/lib/src/components/context_menu/stream_adaptive_menu_anchor.dart:416)
…om the keyboard Opening the menu focuses the anchor's fallback focus node, which traversal skips, so the arrow keys could not reach the rows. Directional focus from that node now continues from the first focusable widget in the anchor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Theme anchored rows and headings through StreamContextMenuAnchorTheme; drop menuItemStyle, menuSelectedItemColor and menuHeadingStyle from the style. - Add selected to StreamContextMenuAction, and draw an action with nothing to do as plain content. - Use VerticalDirection, isDesktopOrWeb and StreamAdaptiveMenuController, and the StreamMenuSections.hasEntries extension. - close() removes the sheet's own route, and disposing the anchor removes an open sheet. - Announce a choice as checked in a mutually exclusive group. - Trim the docs, and split the tests by feature. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Withdrawing approval until 9cc6177 is reviewed.
| @override | ||
| void didUpdateWidget(DefaultStreamAdaptiveMenuAnchor oldWidget) { | ||
| super.didUpdateWidget(oldWidget); | ||
| if (identical(oldWidget.props.sections, _props.sections)) return; |
There was a problem hiding this comment.
consider: Open sheet not rebuilt when only title or row state changes
didUpdateWidget bumps _revision only when sections is not identical, but the sheet reads _props.title and _props.sections live. A changed title, or a cached list whose row closures read new state, stays stale in an open sheet. Bumping the revision on any props change fixes it.
Useful? React 👍 or 👎. Disagree? Reply here.
| isDismissible: true, | ||
| anchorPoint: box?.localToGlobal(box.size.center(Offset.zero)), | ||
| builder: (context, scrollController) { | ||
| _sheetRoute ??= ModalRoute.of(context); |
There was a problem hiding this comment.
consider: Sheet route is captured only on first build
_sheetRoute is assigned inside the sheet builder, so open(); close(); in one frame returns early at route == null and leaves the sheet open. dispose() before the first build leaves the route orphaned for the same reason. Capturing the route when the sheet is pushed closes both gaps.
Useful? React 👍 or 👎. Disagree? Reply here.
There was a problem hiding this comment.
🎉 Approved · round 3
Nice work, Rene! Nothing blocking is left on 9cc61771f395. Ship it 🚀
Left open, your call:
- consider: Open sheet not rebuilt when only title or row state changes (
packages/stream_core_flutter/lib/src/components/context_menu/stream_adaptive_menu_anchor.dart:347) - consider: Sheet route is captured only on first build (
packages/stream_core_flutter/lib/src/components/context_menu/stream_adaptive_menu_anchor.dart:436)
Renames StreamMenuOption to StreamMenuEntry, its closesMenu to closeOnActivate and StreamMenuSection.options to entries. The anchor's builder takes MenuAnchor.builder's shape, with a child prop passed through. Sheet radios are 20, the size of the sheet's icon slot. A selected sheet row keeps its fill but no longer announces selected, so a choice reads only as checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Withdrawing approval until d25564c is reviewed.
|
🔍 Round 4 in progress
Details on the checks tab. |
What
StreamAdaptiveMenuAnchorpresents a list ofStreamMenuSections in one of two ways. On desktop and web it is an anchoredStreamContextMenuAnchorwith denseWeb / Menu Itemrows. On Android and iOS it is ashowStreamSheetofStreamListTiles. The split comes from the sharedisDesktopOrWeb(context)(feat(ui): add StreamModalDialog #225), so a phone browser gets the anchored menu, as it gets the dialog's desktop variant. Supporting types, all@experimental:StreamMenuEntry(afterDropdownMenuEntry),StreamMenuSection(entries),StreamMenuContentBuilder, theStreamMenuSections.hasEntriesextension,StreamAdaptiveMenuController(afterMenuController) andStreamAdaptiveMenuAnchorBuilder, which hasMenuAnchor.builder's(context, controller, child)shape with achildprop passed through.directionis Flutter'sVerticalDirection.StreamRadioIndicator(sm, 16px, in the anchored menu andmd, 20px, in the sheet; no focus, no semantics of its own), a trailing value,closeOnActivate: falserows, and customcontentsections. Choice rows announcecheckedin a mutually exclusive group, asRadioMenuButtondoes, and notselected. Optional props:matchAnchorWidth,directionandalignmentOffset,menuItemStyle(passed to the anchor as itsactionStyle),menuElevation,useSheetandchild.close()removes the sheet's own route, so a dialog opened from acloseOnActivate: falserow stays up. Removing the anchor removes its open sheet.StreamContextMenuAnchor(feat(ui): add StreamContextMenuAnchor #226) already gives headings the Web heading style, and a heading takes its row size and padding from the rows around it, so it comes out 32 tall and at least 200 wide, inset like the rows, and keeps following them whenmenuItemStylemakes them taller. Anchored rows and headings are themed only throughStreamContextMenuAnchorTheme(actionStyle/headingStyle). In the sheet, the heading's horizontal padding is copied from the tiles'contentPadding, and both share the same outer inset. The candidate padded the heading byspacing.xsinstead, which only lined up with the video heading's own inset. A collapsible heading passes the heading'sisExpanded, so screen readers announce the fold.StreamAdaptiveMenuAnchorTheme/StreamAdaptiveMenuAnchorThemeData {style, useSheet}, ported from the video repo. It is reached throughStreamTheme.adaptiveMenuAnchorThemeandcontext.streamAdaptiveMenuAnchorTheme.StreamAdaptiveMenuAnchorTheme.of(context).merge(...)works, so a panel can forceuseSheet: falseand keep the rest of the app theme. A test covers that.StreamAdaptiveMenuAnchorStylekeeps the candidate'ssheetTileStyle. ItsmenuItemStyleis gone: anchored rows and headings are themed through feat(ui): add StreamContextMenuAnchor #226'sStreamContextMenuAnchorTheme, so they can't be themed in two places. It adds these fields for values that were hard-coded:menuGap: the gap on thedirectionside. Defaults tospacing.xs, which is the candidate's 8.sheetHeadingStyle(StreamContextMenuHeadingStyle)sheetPadding: the inset around sheet rows, headings and content. Defaults tospacing.xxshorizontally._StreamAdaptiveMenuAnchorStyleDefaultsin the widget file.StreamContextMenuAction.selected: resolves the style withWidgetState.selected, and the defaultbackgroundColorfills it withcolorScheme.backgroundSelected, asStreamListTiledoes. An action with noonTapandcloseOnActivate: falseis drawn as plain content: not focusable, not a button, no ink, with its enabled colors.StreamContextMenuAnchorkeyboard fix (separate commit, feat(ui): add StreamContextMenuAnchor #226's file): the arrow keys now reach a menu opened from the keyboard. Opening focuses the anchor's fallback focus node, which traversal skips.StreamComponentBuilders.adaptiveMenuAnchorwithStreamAdaptiveMenuAnchorProps/DefaultStreamAdaptiveMenuAnchor. Apps use this top-level widget directly, not as a building block inside another component, so it gets a hook.[Components]/Context Menu/StreamAdaptiveMenuAnchor.matchAnchorWidth), direction up/down, section headings, collapsible section, content section (a reaction strip that closes through the controller), toggle row and menu elevation. The radio-choice sections are always shown.video.dart(experimental), in the same sorted export block and "move to core" comment as the rest of the stack. The classes are marked@experimental.Figma
Why
This graduates the design-system candidate from stream-video-flutter, so the SDK can delete its copy and import this one. Sources on v2:
stream_adaptive_menu_anchor.dartadaptive_menu_anchor_theme.dartThey were built up in GetStream/stream-video-flutter#1320, #1332, #1365, #1433, #1458 and #1491. Figma: participant layout menu, more menu. I did not re-check against Figma; the row metrics come from
StreamContextMenuAnchor(#226).API changes compared with the candidate:
const, because it buildspropsfor the factory, as every factory-backed component does. The fields now live onanchor.props.StreamAdaptiveMenuAnchorStyledropsmenuItemStyle(useStreamContextMenuAnchorTheme.actionStyle) and gainsmenuGap,sheetHeadingStyleandsheetPadding.StreamMenuOption→StreamMenuEntry(andoptions→entries),StreamMenuHandle→StreamAdaptiveMenuController,closesMenu→closeOnActivate,StreamMenuSectionsX.hasNoOptions→StreamMenuSections.hasEntries.StreamMenuDirectionis replaced byVerticalDirection, and the builder takes achild.matchAnchorWidth, the panel's constraints now come fromStreamContextMenuAnchorThemeData.constraintswhen that is set, instead of always usingdefaultConstraints.StreamContextMenuHeadingdefaults (40 tall), and their inset is derived from the tiles. The video heading was 32 tall and was padded byspacing.xs.Verified
melos bootstrap, thenmelos run generate:flutter, which regeneratedstream_theme, the component factory, the new theme and the gallery directories. Re-run after rebasing onto feat(ui): add StreamContextMenuAnchor #226 andmain.melos run format:verify,melos run analyze(no issues),melos run check:barrelsandmelos run check:tokens: all pass.flutter test --exclude-tags goldeninstream_core_flutter: all 1167 tests pass. The component's tests are split into main, sheet, heading, theme, fold and controller files sharing a harness. Semantics tests check that choice rows readcheckedin a group in both presentations and neverselected. A keyboard test checks that the arrow keys move between rows and Esc closes and returns focus to the anchor. Tests forclose()under a dialog and for removing the anchor with the sheet open fail on the old code._TestWrapperreplaces the videoTestWrapper, andshowDialogreplacesshowStreamModalDialog, which is not in core.menuItemStyle, theisExpandedfold state, the selected-row fill, the inert action, every new theme field with "param beats theme" checks, theof().merge(useSheet: false)pattern, lerp, the context extension and the factory hook. None of them merge twoBorderSides.dart analyze --fatal-infosinapps/design_system_gallery: no issues. I have not clicked through it in the running gallery.stream_adaptive_menu_anchor_{menu,sheet}_{light,dark}) open both presentations inside a scenario-localNavigator, so the menu and the sheet land in the captured area. I checked the local macOS output by eye: headings sit flush with the radio column in both presentations. Theupdate_goldensbot has committedgoldens/ci/for this branch, and the goldens still pass after the switch toStreamRadioButton.🤖 Generated with Claude Code







