flutter / flutter/flutter-intellij

Display golden tests within code editor

Open
#4,566 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
2k
Forks
356
Avg merge
1d 11h
Merged PRs (30d)
27

Description

This is a feature request that I've wanted in other platforms for years and I'm curious if we can make it happen with Flutter/IntelliJ.

A common friction point in app development is uncertainty about what a given widget actually displays. This is true for other toolkits too, like `View`s in Android and `UIView`s in iOS. This friction can show up when you haven't worked with part of an app project for a while, or as the result of being somewhat new on a team.

I'd like to suggest an ability to display golden file images within the source editor. This way when you're looking at a widget definition you can immediately see what that widget displays in the UI (assuming that someone has produced the appropriate golden file).

I'm sure there are a number of ways this could be accomplished, but perhaps one way is through annotations:

```
@preview('./previews/tooltip.png')
// <-- the editor would automatically display the image right here once the annotation is written
class Tooltip extends StatefulWidget {
//...
}
```

There could also be a default attempt to lookup a preview file by naming convention to avoid needing to type it each time.

Someone may recommend offering this feature in one of those Flutter side panes rather than the editor. That would certainly be better than nothing. However, those side panes do take up a lot of horizontal space, and the particular preview that I'm interested in will be based on my scroll position in the source file. So I'm not sure a side pane display would be ideal.

The ability to generally preview UI in the IDE might make this feature request irrelevant. But the important thing here, in my opinion, is the ability to clearly see what a single widget displays, rather than the entire UI.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.