Skip to content

feat(ui): add StreamModalDialog - #225

Open
renefloor wants to merge 9 commits into
mainfrom
feat/stream-modal-dialog
Open

renefloor wants to merge 9 commits into
mainfrom
feat/stream-modal-dialog

Conversation

@renefloor

@renefloor renefloor commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

What

  • StreamModalDialog: a centered modal surface with an optional header, a body and an optional footer row of actions. Props: header, content, contentPadding, actions, constraints, semanticLabel. The default constraints are 720 × 640 max. The header and footer stay pinned while the body scrolls.
  • StreamModalDialogHeader: the header passed as header. Slots: leading (e.g. a back button, never implied), a one-line title and subtitle, and trailing (a Row for several actions). It also takes showCloseButton, onClose (defaults to Navigator.maybePop), excludeHeaderSemantics and a per-instance style. Its title names the route; the dialog falls back to its localized label only when header is null.
  • Footer: on desktop and web the actions sit in an OverflowBar, as in AlertDialog, so they stack instead of overflowing at large text scales. On mobile they share the width equally.
  • showStreamModalDialog<T>(): opens the dialog over a StreamBlurScrim with the video SDK's fade + scale transition, in which the scrim's blur grows too; animationStyle overrides its duration and curves, as in showDialog. It captures the InheritedThemes between the caller and the navigator, so a StreamModalDialogTheme (or Theme) around the caller reaches the dialog and the scrim. On a folded window it anchors to the trailing top corner unless anchorPoint is given.
  • StreamBlurScrim: the translucent fill over a backdrop blur. color and blurSigma (0 skips the blur).
  • StreamModalDialogTheme / StreamModalDialogThemeData (@themeGen, on StreamTheme.modalDialogTheme, context.streamModalDialogTheme):
    • surface: backgroundColor, elevation, shadowColor, shape, insetPadding, constraints
    • headerStyle: StreamModalDialogHeaderStyle with padding, titleTextStyle, subtitleTextStyle, spacing (between leading, title and trailing) and actionsSpacing (trailing to the close button)
    • footerStyle: StreamModalDialogFooterStyle with padding and actionsSpacing
    • barrier: barrierColor, barrierBlurSigma
    • body: contentPadding (24 on every side, or 16 on mobile). As with AlertDialog, the header has no bottom padding and the footer no top padding, so a dialog with header: null starts with the body's own padding.
    • Defaults resolve from colorScheme.backgroundElevation1 / backgroundScrim / textPrimary, streamElevation.level4, Material's colorScheme.shadow, streamRadius.xl, streamSpacing.{xxl,xl,md,xs} and textTheme.headingSm. No hard-coded colors.
  • Factory hooks: StreamComponentFactory.modalDialog (StreamModalDialogProps / DefaultStreamModalDialog) and modalDialogHeader (StreamModalDialogHeaderProps / DefaultStreamModalDialogHeader). StreamBlurScrim has no hook because it is a building block of the modal and not a component on its own.
  • Internal: the surface and close button (StreamModalSurface, StreamModalCloseButton), the scope that stops the header naming the route when the dialog has a semanticLabel, and resolveStreamModalDialogTheme live in components/dialog/internal/stream_modal_parts.dart, which is added to check_barrels.yaml internal_dirs. The follow-up StreamModalWindow will reuse them, so it gets the same surface and header from this theme and only themes its own sidebar. trailingTopAnchorOf is ported into lib/src/utils/display_fold.dart. The rest of the video repo's fold utilities are left out because nothing here uses them yet.
  • Gallery: [Components]/Dialog has a Playground with knobs for the header, back button, title, subtitle, header actions, close button, footer actions, long scrolling content, blur on/off and barrier dismissible, plus a Showcase.
  • Barrel: video.dart (experimental), next to the split button.
  • Platform-adaptive defaults: StreamModalDialog is the first stream-core-flutter component with mobile-vs-web defaults. Android and iOS use the Figma Mobile metrics, while desktop and web share the Web ones, following the isDesktopOrWeb split from feat(ui, samples): large-screen call app bar with participants and latency badges stream-video-flutter#1620.

Figma

Why

This graduates the design-system candidate from stream-video-flutter so the video SDK can delete its copy and import this one instead:

The scrim reads from the modal dialog theme instead of getting a theme of its own. It is only ever drawn as a modal's barrier, and the later StreamModalWindow opens through showStreamModalDialog too, so one theme covers both.

API changes compared with the candidate:

  • The header is a slot: title, headerActions, showCloseButton and onClose move onto StreamModalDialogHeader, passed as header:, and child is now content. The video SDK's call sites need that move when they switch to this dialog.

  • The StreamModalDialog constructor is no longer const, because it builds its factory props the same way every other component here does. const StreamModalDialog(...) call sites need to drop the const. The video SDK's non-test code has none.

  • StreamModalDialog.constraints and StreamBlurScrim.blurSigma are nullable now, so they can fall back to the theme. They default to the same values as before.

  • The showStreamModalDialog parameters are unchanged. They follow showDialog (routeSettings, barrierDismissible, useRootNavigator = true) rather than showStreamSheet (settings, isDismissible, useRootNavigator = false). anchorPoint and useRootNavigator have the same names in both.

Verified

  • melos bootstrap, melos run generate:flutter
  • melos run format, melos run format:verify: clean
  • melos run analyze: no issues
  • melos run check:barrels: success
  • flutter test --exclude-tags golden in packages/stream_core_flutter: all 1024 pass. This includes the ported video tests (fold placement, the scrim following a theme change, a theme around the caller reaching the dialog), new theme-override and widget-beats-theme tests, a test that a StreamModalDialogTheme around the caller is captured into the route, the factory hooks, trailingTopAnchorOf, the header slots, style and semantics, and the footer at a 2× text scale (which fails with the old Row).
  • dart analyze --fatal-infos in apps/design_system_gallery: no issues
  • stream_modal_dialog_golden_test.dart covers the light/dark matrices. It passed locally (macOS output checked by eye), and the goldens/ci/ images are generated by the update_goldens workflow on this branch.
  • Spacing and colors have not been checked against Figma beyond what the candidate already matched.

🤖 Generated with Claude Code

golden_screen_share_modal_dialog_dark golden_screen_share_modal_dialog_light settings_dialog_blur_scrim_dark settings_dialog_blur_scrim_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 97.22222% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.49%. Comparing base (84add9d) to head (94fea35).

Files with missing lines Patch % Lines
...rc/theme/components/stream_modal_dialog_theme.dart 76.47% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #225      +/-   ##
==========================================
+ Coverage   73.13%   73.49%   +0.35%     
==========================================
  Files         220      224       +4     
  Lines        9497     9641     +144     
==========================================
+ Hits         6946     7086     +140     
- Misses       2551     2555       +4     

☔ 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 #232 November 10, 2026 15:28
@renefloor
renefloor force-pushed the feat/stream-modal-dialog branch from f1fa760 to e482190 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-modal-dialog branch from e482190 to 0eb4b72 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[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 0eb4b72d064e after 1 round

@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: #225 (review)

@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 showDialog / Dialog / AlertDialog, and Figma. The API follows showDialog, but routing through showGeneralDialog loses things showDialog gives for free. There are also a few gaps against the Figma Modal Window.

Design questions (for the designers)

  • Figma's title wraps; the code clamps it to one line with an ellipsis. Which is intended?
  • The Figma window is a fixed 720×640 with the footer pinned to the bottom; the code shrinks to its content. Fixed or content height?
  • Naming: Figma calls it "Scrim Blur" (token background/core/scrim), and Flutter, our sheet theme and this PR's own barrierDismissible/barrierLabel say "barrier". I'd lean barrierColor/barrierBlurSigma for API consistency. Any objection?

Note on Figma: the "Dialog" nodes linked in the description (6836:77681, 19881:670034) are the alert dialog (304 wide, centred icon, stacked full-width buttons), not this component. The real counterparts are the Modal Window (944:65287) and the Modal Dialog Header/Footer (20616:557906 / 20616:557964). Please point the description there.

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

Withdrawing approval until 3521821 is reviewed.

@renefloor
renefloor force-pushed the feat/stream-modal-dialog branch from 1539f19 to a0486b5 Compare November 25, 2026 12:38
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.82609% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.56%. Comparing base (c584c80) to head (a0486b5).

Files with missing lines Patch % Lines
...rc/theme/components/stream_modal_dialog_theme.dart 76.47% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #225      +/-   ##
==========================================
+ Coverage   75.13%   75.56%   +0.42%     
==========================================
  Files         220      225       +5     
  Lines        9563     9747     +184     
==========================================
+ Hits         7185     7365     +180     
- Misses       2378     2382       +4     

☔ 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.

@getstream-metis

Copy link
Copy Markdown

No open findings, but I'm not approving this head: changes requested by xsahil03x.

@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. The Mobile/Desktop switch is resolved cleanly as defaults. One question on the transition, plus nits.

@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.

I ran the gallery for this PR on web and macOS. The dialog itself behaves well: it opens and closes with Esc, returns its value, stops at 640 with the body scrolling, and the dark surface outline shows. These comments are about the gallery examples.

@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.

Two more notes on the Showcase from running it locally.

@getstream-metis

Copy link
Copy Markdown

No open findings, but I'm not approving this head: changes requested by xsahil03x.

renefloor and others added 3 commits December 1, 2026 12:01
Graduates the StreamModalDialog / showStreamModalDialog / StreamBlurScrim
design-system candidate from stream-video-flutter, with a
StreamModalDialogTheme on StreamTheme, a modalDialog factory hook, a gallery
page and tests. Exported from the experimental video.dart barrel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
StreamModalSurface passed StreamColors.transparent (0x00FFFFFF) as the
Dialog's surfaceTintColor. Material 3 only skips the tint for exactly
Colors.transparent, so it blended white in at elevation level4 and the dark
surface painted ~#383838 instead of backgroundElevation1 (#1c1c1c).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Material 3's dialog defaults to a transparent shadow color, so the
level4 elevation drew nothing and an app's DialogTheme decided the
shadow. Add a themed `shadowColor` and pass it explicitly. Mark the
title with `namesRoute` so screen readers announce it on open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
renefloor and others added 3 commits December 1, 2026 12:01
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- `contentPadding` now defaults to 24 (16 on mobile) at the sides and bottom,
  and the footer drops its top padding, so a dialog without a footer no longer
  ends on its body, as with `AlertDialog`.
- `showStreamModalDialog` takes an `AnimationStyle`, and the scrim's blur grows
  with the transition.
- Resolve `effective*` locals before building; trailing commas.
- Gallery: open the Playground in the preview's navigator, outline the example
  panels, let them grow with the dialog, add a Mobile example and replace the
  alert-style "Discard changes?" with a task-style one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The body now pads itself on every side, as AlertDialog's content does, and
the header has no bottom padding, so a dialog without a title, header actions
or close button no longer starts with an empty 88px band.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@renefloor
renefloor force-pushed the feat/stream-modal-dialog branch from 4a19a30 to 650d780 Compare December 1, 2026 11:04
@getstream-metis

Copy link
Copy Markdown

No open findings, but I'm not approving this head: changes requested by xsahil03x.

@github-actions github-actions Bot added pending Review comments waiting to be addressed and removed ready Pull request ready to be reviewed labels Dec 1, 2026
renefloor and others added 2 commits December 1, 2026 13:38
…actions

Makes the header public as StreamModalDialogHeader, passed as
StreamModalDialog.header, with leading, title, subtitle and trailing slots,
the close button, a per-instance style and a component-factory entry. The
body is now `content`.

On desktop and the web the footer actions sit in an OverflowBar, so they
stack instead of overflowing at large text scales.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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 · 🆕 1 new · nothing blocking

Widget build(BuildContext context) {
final theme = resolveStreamModalDialogTheme(context);
final effectiveContentPadding = props.contentPadding ?? theme.contentPadding!;
final label = props.semanticLabel ?? (props.header == null ? _fallbackLabel(context) : null);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

consider: Dialog has no accessible name when its header cannot name it
The alertDialogLabel fallback only applies when header is null, so a header with excludeHeaderSemantics: true or no title and subtitle leaves the dialog unnamed on non-Apple platforms. Falling back whenever semanticLabel is null and the header cannot name the route keeps the documented behaviour.

Useful? React 👍 or 👎. Disagree? Reply here.

@getstream-metis

Copy link
Copy Markdown

No open findings, but I'm not approving this head: changes requested by xsahil03x.

@renefloor renefloor added the ready Pull request ready to be reviewed label Dec 1, 2026
@github-actions github-actions Bot removed the pending Review comments waiting to be addressed label Dec 1, 2026

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

jeffery:review ready Pull request ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants