flutter / flutter/flutter-intellij

Color preview in IDE doesn't show correct colors for a custom Colors class

Open
#4,079 6 comments 1 reaction 0 assignees View on GitHub
good-first-issue P3 topic-editing
Dominant language
Java
Stars
2k
Forks
356
Avg merge
1d 11h
Merged PRs (30d)
27

Description

## Steps to Reproduce

I'm trying to create a custom palette of colors where the squares of the color preview can be seen in the IDE.

I created a class `Palette` with `static const` colors, and this is what I see:

[![enter image description here][1]][1]

If I rename the class `Palette` to `Colors`, this is what I see:

[![enter image description here][2]][2]

But the color `other` doesn't show its preview and the color values shown above aren't the values I defined:

[![enter image description here][3]][3]

So my questions are:

- How can I preview the correct colors in autocomplete?
- Is it possible to use the name `Palette` instead of `Colors` to show that?

Note: I'm using Android Studio.

[1]: https://i.stack.imgur.com/0yDaY.png
[2]: https://i.stack.imgur.com/iwrKj.png
[3]: https://i.stack.imgur.com/yVZk2.png

## Version info

[✓] Flutter (Channel beta, v1.9.1+hotfix.4, on Linux, locale en_US.UTF-8)
• Flutter version 1.9.1+hotfix.4 at /home/pablo/work/soft/flutter
• Framework revision cc949a8e8b (6 weeks ago), 2019-09-27 15:04:59 -0700
• Engine revision b863200c37
• Dart version 2.5.0

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/pablo/work/soft/android-sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-29, build-tools 28.0.3
• ANDROID_HOME = /home/pablo/work/soft/android-sdk
• ANDROID_SDK_ROOT = /home/pablo/work/soft/android-sdk
• Java binary at: /home/pablo/work/soft/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.

[✓] Android Studio (version 3.5)
• Android Studio at /home/pablo/work/soft/android-studio
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the custom Palette and Colors cases in Android Studio using the versions listed in the issue. Trace the Flutter/Dart plugin's IDE color-preview and autocomplete handling; done means previews show the declared values for custom class names, including the `other` color.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, java
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.