Skip to content

Pass theme info to Widget Preview + support auth frame bouncing#5715

Merged
DanTup merged 3 commits intomasterfrom
widget-preview-auth-and-theme
Sep 22, 2025
Merged

Pass theme info to Widget Preview + support auth frame bouncing#5715
DanTup merged 3 commits intomasterfrom
widget-preview-auth-and-theme

Conversation

@DanTup
Copy link
Member

@DanTup DanTup commented Sep 22, 2025

Fixes #5702

@DanTup DanTup added this to the v3.120.0 milestone Sep 22, 2025
@DanTup DanTup added is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix. in flutter Relates to running Flutter apps in flutter widget preview Relates to the embedded Flutter widget preview labels Sep 22, 2025
@DanTup DanTup requested a review from Copilot September 22, 2025 14:15
@DanTup
Copy link
Member Author

DanTup commented Sep 22, 2025

@codex review
/gemini review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds theme information support to the Flutter Widget Preview and implements authentication frame bouncing functionality. The changes enable proper theme synchronization between VS Code and the widget preview iframe while providing authentication handling for DevTools connections.

  • Refactored widget preview to accept WebViewUrls instead of simple strings for enhanced URL handling
  • Added theme detection and transmission functionality to pass VS Code theme information to widget preview
  • Implemented authentication URL handling to support DTD connections

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/extension/sdk/dev_tools/embedded_view.ts Removed extra blank line for code cleanup
src/extension/flutter/widget_preview/widget_preview_manager.ts Updated to use WebViewUrls structure and include DTD authentication URLs
src/extension/flutter/widget_preview/webviews.ts Added comprehensive theme handling, URL authentication, and dynamic iframe source management

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the Flutter Widget Preview by passing theme information (like dark/light mode and colors) from VS Code to the preview, allowing it to adapt to the editor's theme. It also introduces a mechanism for handling authentication by "bouncing" through auth URLs in hidden iframes, which is useful in certain environments. The changes are well-structured, introducing a shared WebViewUrls type and helper functions. My review includes a couple of minor suggestions for improving code quality and debug logging in the webview script.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

@DanTup DanTup merged commit 756fdf3 into master Sep 22, 2025
15 checks passed
@DanTup DanTup deleted the widget-preview-auth-and-theme branch September 22, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in flutter widget preview Relates to the embedded Flutter widget preview in flutter Relates to running Flutter apps is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pass theme colours to Widget Preview on querystring in the same format as DevTools

2 participants