-
Notifications
You must be signed in to change notification settings - Fork 330
Add widget previewer tool window #8595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+603
−57
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4823d8e
Add widget previewer panel
helin24 5459a92
Set min SDK, change command display
helin24 db4bdc8
Clean up nullability
helin24 418a3ae
Rename and clean up some null issues
helin24 e4065cd
Add verbose flag for preview command
helin24 4bc899d
Move text parsing code
helin24 1963502
Extract class for listening
helin24 2c42dd9
Hide for old versions and add icons
helin24 0bdc19b
Add reload on theme change
helin24 f73c33e
Rename to widget preview
helin24 3b7aa36
Formalize capitalization
helin24 0e27e47
Remove unneeded fields
helin24 eb93757
Fix color of mini Flutter icon
helin24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /* | ||
| * Copyright 2025 The Chromium Authors. All rights reserved. | ||
| * Use of this source code is governed by a BSD-style license that can be | ||
| * found in the LICENSE file. | ||
| */ | ||
| package io.flutter.view; | ||
|
|
||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| /** | ||
| * Saves a browser URL that may be editable depending on additional settings from the IDE or running applications. | ||
| */ | ||
| public interface BrowserUrlProvider { | ||
| void setWidgetId(@NotNull String widgetId); | ||
|
|
||
| @NotNull String getBrowserUrl(); | ||
|
|
||
| boolean maybeUpdateColor(); | ||
|
|
||
| boolean setVmServiceUri(@NotNull String vmServiceUri); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Copyright 2025 The Chromium Authors. All rights reserved. | ||
| * Use of this source code is governed by a BSD-style license that can be | ||
| * found in the LICENSE file. | ||
| */ | ||
| package io.flutter.view; | ||
|
|
||
| import io.flutter.devtools.DevToolsUrl; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| public record DevToolsUrlProvider(@NotNull DevToolsUrl url) implements BrowserUrlProvider { | ||
| @Override | ||
| public void setWidgetId(@NotNull String widgetId) { | ||
| url.widgetId = widgetId; | ||
| } | ||
|
|
||
| @Override | ||
| public @NotNull String getBrowserUrl() { | ||
| return url.getUrlString(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean maybeUpdateColor() { | ||
| return url.maybeUpdateColor(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean setVmServiceUri(@NotNull String newVmServiceUri) { | ||
| if (url.vmServiceUri != null && url.vmServiceUri.equals(newVmServiceUri)) { | ||
| return false; | ||
| } | ||
| url.vmServiceUri = newVmServiceUri; | ||
| return true; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also pass
--dtd-url=<url>here and, if the plugin hosts a DevTools instance,--devtools-server-address=<url>.Does the Intellij plugin provide the DTD
Editorservice?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, both should be available. How does the the widget preview interact with DevTools?
IntelliJ is intended to serve as an Editor, at least if we're thinking of the same thing (https://github.com/dart-lang/sdk/blob/bc7e4d9fb583c9edeb90393f65989767e865e56f/pkg/dtd_impl/dtd_common_services_editor.md?plain=1#L4), but looking at the code now I'm not sure if this was implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the current beta, it doesn't directly interact with DevTools and passing this flag just prevents Flutter Tools from serving another DevTools instance. In the near future, this DevTools instance will be embedded in the widget previewer in an iframe which displays the widget inspector.
Ah, it'd be great if this was implemented. The widget previewer can provide additional functionality if this service is available, including filtering previews based on the currently selected file and jumping to source from file URIs in stack traces displayed for previews which throw exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkonyi could you file an issue to this repo about implementing the editor services and what functionality will be available for each service that's relevant, maybe with examples from VS Code if you know of them?