You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Asset variant detection should only work on directory names that are parse-able by the framework (2x, 3x) #69388
This is mostly an intention feature - asset variants. The idea is that you can automatically pick up multiple resolutions of the same image and have the framework select them at runtime.
a.png
2x/a.png
3x/a.png
Of course, it is not actually restricted to 2x, 3x as you've discovered here....
changed the title [-]Wrong display when using same name but not the same path assets[/-][+]Asset variant detection should only work on directory names that are parse-able by the framework (2x, 3x)[/+]on Oct 30, 2020
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
yash1200 commentedon Oct 30, 2020
Changing your assets list to this :
and pubspec.yaml to this :
These changes fixed your issue.
AlexV525 commentedon Oct 30, 2020
@yash1200 That's weird. Since when we could use undeclared assets? Doc ref:https://flutter.dev/docs/development/ui/assets-and-images#specifying-assets
And why an asset without full path can be used?
yash1200 commentedon Oct 30, 2020
I just experimented and it worked with this.
Here's a screenshot:
pedromassangocode commentedon Oct 30, 2020
I was able to reproduce however not sure if the implementation is the correct one.
AlexV525 commentedon Oct 30, 2020
Thanks for the quick clarify! So there must be something broken with assets loading.
AlexV525 commentedon Oct 30, 2020
cc @jonahwilliams
pedromassangocode commentedon Oct 30, 2020
Maybe P3 since this is not blocking any customer?
Feel free to increase the priority if necessary.
jonahwilliams commentedon Oct 30, 2020
This is mostly an intention feature - asset variants. The idea is that you can automatically pick up multiple resolutions of the same image and have the framework select them at runtime.
Of course, it is not actually restricted to 2x, 3x as you've discovered here....
AlexV525 commentedon Oct 30, 2020
When it comes to production cases, assets like the demo in my test app, such as separate placeholder can cause confusing behaviors.
And what about the solution that @yash1200 suggested?
jonahwilliams commentedon Oct 30, 2020
I think the right fix would to restrict the asset variant code to strings that the framework can parse
[-]Wrong display when using same name but not the same path assets[/-][+]Asset variant detection should only work on directory names that are parse-able by the framework (2x, 3x)[/+]christopherfujino commentedon Aug 1, 2022
cc @eliasyishak
jonahwilliams commentedon Aug 10, 2022
I think this one might be an interesting first issue for @andrewkolos , if you haven't already looked at it @eliasyishak .
github-actions commentedon Oct 11, 2022
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.