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-adaptive-menu-anchor #229 +/- ##
====================================================================
+ Coverage 76.04% 76.38% +0.34%
====================================================================
Files 232 234 +2
Lines 10098 10252 +154
====================================================================
+ Hits 7679 7831 +152
- Misses 2419 2421 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8b0b66f to
ba71d81
Compare
ba71d81 to
dacf669
Compare
456763d to
4f7bf37
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 9cb7b5da7f69. Ship it 🚀
Left open, your call:
- consider: Shrinking tabs changes selection without calling onTabChanged (
packages/stream_core_flutter/lib/src/components/dialog/stream_modal_window.dart:216) - consider: Sidebar list tile theme ignores an app-level local theme (
packages/stream_core_flutter/lib/src/components/dialog/stream_modal_window.dart:329)
| child: Column( | ||
| crossAxisAlignment: CrossAxisAlignment.stretch, | ||
| children: [ | ||
| StreamModalHeader( |
There was a problem hiding this comment.
Done when #225 landed its header API: the window draws StreamModalDialogHeader(title: tab.label, showCloseButton: props.showCloseButton, onClose: props.onClose). The public widget ended up named StreamModalDialogHeader, and its style comes from StreamModalDialogThemeData.headerStyle, the same as the dialog's header. There is no separate header theme.
| // over the default. | ||
| final backgroundColor = style?.backgroundColor ?? resolveStreamModalDialogTheme(context).backgroundColor!; | ||
|
|
||
| return StreamModalSurface( |
There was a problem hiding this comment.
Unlike DefaultStreamModalDialog, the window doesn't scope or name its route. Add a semanticLabel prop and the same Semantics(scopesRoute, namesRoute, explicitChildNodes, label) wrap, with the same platform fallback.
There was a problem hiding this comment.
Added semanticLabel in 9acba32. When it is set, the window is wrapped in the same Semantics(scopesRoute, namesRoute, explicitChildNodes, label) as the dialog, and the header is told not to name the route. I left out the platform fallback: the window always has a title (the selected tab's label), which names it. The dialog only falls back when it has no header. Tests cover both cases.
| final states = {if (selected) WidgetState.selected}; | ||
| final iconColor = listTileTheme.iconColor?.resolve(states) ?? colorScheme.textSecondary; | ||
| final labelColor = listTileTheme.titleColor?.resolve(states) ?? colorScheme.textPrimary; | ||
| final labelStyle = listTileTheme.titleTextStyle ?? context.streamTextTheme.bodyDefault; |
There was a problem hiding this comment.
The sidebar labels fall back to bodyDefault. Figma's sidebar rows use caption/default on text/primary. Default the nav item's titleTextStyle to captionDefault.
There was a problem hiding this comment.
Done in 9acba32. The rows' titleTextStyle defaults to captionDefault, and the color stays the list tile's textPrimary. A test checks it.
| Widget build(BuildContext context) { | ||
| final props = widget.props; | ||
| final style = context.streamModalWindowTheme.style; | ||
| final defaults = _StreamModalWindowStyleDefaults(context); |
There was a problem hiding this comment.
The style?.x ?? defaults.x fallbacks are spread through build and _Sidebar. Resolve every value once at the top of build as effective* locals, as in StreamCheckbox, and pass resolved values down instead of style and defaults.
There was a problem hiding this comment.
Done in 9acba32. build resolves every value once as an effective* local and passes the resolved values to the sidebar and rows. The sidebar no longer sees style or defaults.
| child: tab.icon, | ||
| ); | ||
|
|
||
| Widget item = StreamListTileContainer( |
There was a problem hiding this comment.
Nit: rows announce as buttons with selected. Give the sidebar SemanticsRole.tabBar and each row SemanticsRole.tab, as NavigationBar does, plus the "Tab 2 of 4" index hint from localizations.tabLabel, as NavigationRail does. Add a test that keyboard traversal moves between tabs.
There was a problem hiding this comment.
Done in 9acba32. Each row now reads as "Device, Tab 1 of 3", with localizations.tabLabel added as in NavigationRail, and is still marked selected. A new test moves focus to the second tab with Tab and selects it with Enter.
There was a problem hiding this comment.
Following your edit: in 2453e89 the sidebar is a SemanticsRole.tabBar node and each row a SemanticsRole.tab with its selected state, as NavigationBar does. Rows still read "Tab N of M" from localizations.tabLabel. A new test checks that the tab bar's children are all tabs, and the keyboard test still moves between tabs and selects one.
| /// A collapsed sidebar shows only the icon. | ||
| final Widget icon; | ||
|
|
||
| /// The tab's name: drawn in the sidebar and as the title of the header. |
There was a problem hiding this comment.
Nit: Use one-line summaries without the colon: "The tab's name, shown in the sidebar and as the header title." / "The visual style of a [StreamModalWindow]'s sidebar and content area." Shorten :157 to "Defaults to [backgroundColor]."
There was a problem hiding this comment.
Done in 9acba32: "The tab's name, shown in the sidebar and as the header title." and "The visual style of a [StreamModalWindow]'s sidebar and content area.". sidebarBackgroundColor now says "Defaults to [StreamModalDialogThemeData.backgroundColor].", since the window's own backgroundColor is gone.
| /// | ||
| /// * [StreamModalWindow], which uses these properties. | ||
| /// * [DefaultStreamModalWindow], the default implementation. | ||
| @experimental |
|
|
||
| /// Called when the close button is pressed. | ||
| /// | ||
| /// Defaults to popping the window with no value. |
There was a problem hiding this comment.
Nit: It doesn't default to anything, so say "If null, the close button pops the window."
There was a problem hiding this comment.
Done in 9acba32: "If null, the close button pops the window."
| child: tab.icon, | ||
| ); | ||
|
|
||
| Widget item = StreamListTileContainer( |
There was a problem hiding this comment.
Nit: Return the Tooltip from inside the if and the bare item otherwise, instead of reassigning item.
There was a problem hiding this comment.
Done in 9acba32. The Tooltip is returned from inside the if.
| expect(tester.getTopLeft(find.text('Device content')).dy - header.bottom, 24); | ||
| }); | ||
|
|
||
| testWidgets('selecting a tab shows it and reports it', (tester) async { |
There was a problem hiding this comment.
Nit: - One behaviour per test: split :135-151; re-selecting being a no-op is a separate test.
- Private helpers: :7, :42 and :61 use
///; use//. - Helper placement: move the helpers below
main, per TESTING.md.
There was a problem hiding this comment.
Done in 9acba32. Re-selecting is its own test, the helpers use // and sit below main.
9cb7b5d to
8146981
Compare
Withdrawing approval until 8146981 is reviewed.
xsahil03x
left a comment
There was a problem hiding this comment.
One more from checking against the video SDK's Modal Window design and NavigationRail.
| child: SizedBox.expand( | ||
| child: LayoutBuilder( | ||
| builder: (context, constraints) { | ||
| final collapsed = constraints.maxWidth < _collapseBelowWidth; |
There was a problem hiding this comment.
The 560 breakpoint has no design behind it: Figma has no icon-only sidebar. Confirm it with design, or let the caller decide, as NavigationRail.extended does (for example bool? collapsed, which falls back to the width check when null).
There was a problem hiding this comment.
Done in 2453e89: StreamModalWindow(collapsed:), like NavigationRail.extended. True shows only icons, false shows icons and labels, and null keeps the width check (collapsed while the window is narrower than 560). Tests cover all three, including both sides of the 560 boundary, and the gallery has a Collapsed knob.
There was a problem hiding this comment.
Round 2 · 🎉 Approved
Nice work, Rene! Nothing blocking is left on 6229f188f27b. Ship it 🚀
Left open, your call:
- consider: Shrinking tabs changes selection without calling onTabChanged (
packages/stream_core_flutter/lib/src/components/dialog/stream_modal_window.dart:216) - consider: Sidebar list tile theme ignores an app-level local theme (
packages/stream_core_flutter/lib/src/components/dialog/stream_modal_window.dart:329)
6229f18 to
9acba32
Compare
Withdrawing approval until 9acba32 is reviewed.
|
Sorry for the churn: I withdrew two of my comments after checking against the video SDK's Modal Window design, and deleted them without saying so. Please revert both:
The rest of the review stands. |
Graduates the StreamModalWindow design-system candidate from stream-video-flutter: a modal with a sidebar of tabs that collapses to icons below 560 wide, built on the shared modal surface and header, with StreamModalWindowTheme on StreamTheme and a component factory hook. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Now that the modal surface paints exactly its background color in dark mode, the sidebar is an opaque Material again, defaulting to the window's effective surface color (backgroundElevation1 unless themed), as in the candidate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The modal header no longer pads its bottom, so the gap below it now belongs to the window's contentPadding, as it does to StreamModalDialog's body. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gHeader The internal StreamModalHeader is now the public StreamModalDialogHeader, so the window uses it with its tab's label as the title. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Builds the sidebar rows as StreamListTiles that announce their tab position, adds semanticLabel, pads the content like a dialog's body and drops the style fields the dialog theme or the list tile already cover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s and collapsed Goes back to the hand-built sidebar rows, with navItemMinHeight, navItemIconSize and navItemSpacing, and to the 24/24/24/32 content padding. The rows keep the caption label style and the layered list tile theme. The sidebar is a tab bar of tabs for screen readers, and `collapsed` lets the caller force the icon-only or the labelled sidebar instead of the width check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l window Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0868bfc to
c960643
Compare
Withdrawing approval until c960643 is reviewed.
|
👀 New commits spotted. ⏳ I'll re-review at 13:47 UTC, once nothing has been pushed for 10 minutes. A new push restarts the wait. Comment |
What
StreamModalWindow+StreamModalWindowTab: a modal with a sidebar of tabs. It shows one tab at a time, under a header with the tab's label and a close button, in a scroll view. Below 560 wide the sidebar collapses to icons, unlesscollapsed(likeNavigationRail.extended) forces either layout. Each icon gets a tooltip, and its label stays in the tree for screen readers. The sidebar is aSemanticsRole.tabBarand each row aSemanticsRole.tabreading "Tab N of M".semanticLabelnames and scopes the route as the dialog's does.onTabChangedreports only the user's selections. The window wraps tab content in aStreamAdaptiveMenuAnchorTheme(useSheet: false), so a menu in a tab stays anchored on phones too. It is opened withshowStreamModalDialog.StreamModalSurfaceand draws its header with feat(ui): add StreamModalDialog #225's publicStreamModalDialogHeader(the tab's label as the title, plusshowCloseButtonandonClose). The window gets the dialog's shape, elevation, inset padding, constraints and header style fromStreamModalDialogTheme, and its own theme covers only the sidebar and the content area.StreamModalWindowTheme/StreamModalWindowThemeData { style }/StreamModalWindowStyle. This is the video theme, wired toStreamTheme.modalWindowThemeandcontext.streamModalWindowTheme. Fields:sidebarWidth,sidebarBackgroundColor,sidebarBorderColor,navItemStyle(aStreamListTileThemeDatalayered overStreamListTileTheme.of(context)and the defaults; labels default tocaptionDefault),contentPadding. New fields for values the candidate hard-coded:sidebarPadding,navItemMinHeight,navItemIconSize,navItemSpacing.StreamModalDialogThemeData.backgroundColor(the window's ownbackgroundColorduplicated it and is gone);sidebarBackgroundColordefaults to it.sidebarBackgroundColordefaults to the window's effective surface color (sobackgroundElevation1unless themed), so the sidebar follows a themed surface instead of going two-tone.constraintsprecedence: widget param →StreamModalDialogThemeData.constraints→StreamModalDialog.defaultConstraints.contentPaddingdefaults to 24 at the start, top and end and 32 at the bottom. feat(ui): add StreamModalDialog #225's header has no bottom padding, so the gap below it belongs to the content, as it does to the dialog's body.StreamComponentFactory.modalWindowwithStreamModalWindowProps/DefaultStreamModalWindow.[Components]/Dialog/StreamModalWindow. The Playground opens a window, and its first tab holds aStreamAdaptiveMenuAnchor. Knobs: number of tabs, initial tab, close button, long labels, narrow window, collapsed (auto, true, false). The Showcase draws the wide and collapsed layouts in place.video.dart(experimental), added to the "move to core when stable" list.Figma
Figma has no component called "Modal Window".
Why
Graduates the
StreamModalWindowdesign-system candidate from stream-video-flutter, so that the video SDK can delete its copy and import this one. The candidate was added in GetStream/stream-video-flutter#1457 and fixed in GetStream/stream-video-flutter#1458. Source on v2:stream_modal_window.dartandmodal_window_theme.dart.API changes vs. the candidate:
StreamModalWindowconstructor is no longerconst, because it buildspropsfor the factory. This matchesStreamModalDialogin feat(ui): add StreamModalDialog #225.constraintsis now nullable (BoxConstraints?) and falls back to the modal dialog theme, then toStreamModalDialog.defaultConstraints. Callers that pass a value are unaffected.StreamModalWindowStyle.sidebarBackgroundColordefaulted tobackgroundElevation1. It now defaults to the window's surface color. Untouched themes get the same value; it only differs when the surface color is themed.StreamModalWindowTheme.ofreadsStreamThemeinstead ofStreamVideoTheme.Verified
melos bootstrap,melos run generate:flutter: the merge of feat(ui): add StreamModalDialog #225 regenerated with no diff, and the new theme and factory regenerated cleanly.melos run format/melos run format:verify: clean.melos run analyze: clean.melos run check:barrels: pass.cd packages/stream_core_flutter && flutter test --exclude-tags golden: all 1212 pass after rebasing onto feat(ui): add StreamAdaptiveMenuAnchor #227, including a test that the content starts 24 below the header. This includes the ported video tests (stream_modal_window_test.dart) plus new theme tests (stream_modal_window_theme_test.dart) covering defaults,StreamThemevalues, local override and inheritance, a theme reaching a window opened as a dialog,navItemStylemerging, the surface/header coming from the modal dialog theme, sidebar and surface painting one color in dark mode (Material 2 and 3), theconstraintsparam beating the theme, a list tile theme around the window reaching the rows,semanticLabel, the tab roles and keyboard traversal, andcollapsedon both sides of 560.cd apps/design_system_gallery && dart analyze --fatal-infos: no issues.stream_modal_window_golden_test.dartcovers wide and collapsed layouts in light and dark, the same scenarios as the video goldens. I checked the macOS output locally: after feat(ui): add StreamModalDialog #225's dark-surface fix, the dark surface and sidebar are one color, matching the video goldens.goldens/ci/is regenerated by theupdate_goldensworkflow on this branch after the rebase.🤖 Generated with Claude Code





