Repository navigation
Asset variant detection should only work on directory names that are parse-able by the framework (2x, 3x) #69388
Description
Activity
Changing your assets list to this :
final List<String> assets = <String>[ 'placeholder.png', 'something/placeholder.png', ];and pubspec.yaml to this :
flutter: uses-material-design: true assets: - assets/These changes fixed your issue.
@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?
- addeda: assetsPackaging, accessing, or using assetsPackaging, accessing, or using assetsfound in release: 1.23Found to occur in 1.23Found to occur in 1.23frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work on
on Oct 30, 2020 I was able to reproduce however not sure if the implementation is the correct one.
I just experimented and it worked with this.
Thanks for the quick clarify! So there must be something broken with assets loading.
Maybe P3 since this is not blocking any customer?
Feel free to increase the priority if necessary.Reacted by Alex Li and Yash Johri- addedP1High-priority issues at the top of the work listHigh-priority issues at the top of the work listand removed
on 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.
a.png 2x/a.png 3x/a.pngOf course, it is not actually restricted to 2x, 3x as you've discovered here....
- addedP2Important issues not at the top of the work listImportant issues not at the top of the work listand removedP1High-priority issues at the top of the work listHigh-priority issues at the top of the work list
on Oct 30, 2020 Of course, it is not actually restricted to 2x, 3x as you've discovered here....
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?
I think the right fix would to restrict the asset variant code to strings that the framework can parse
Reacted by Alex Li, Yash Johri and Pedro Massango- addedtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.and removedframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
on Oct 30, 2020 - 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 - moved this to Good starter bugs/improvements in go/flutter-tools-project (deprecated)
on Jul 11, 2022 cc @eliasyishak
I think this one might be an interesting first issue for @andrewkolos , if you haven't already looked at it @eliasyishak .
Reacted by Christopher Fujino and Elias YishakReacted by Andrew KolosThis 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.- locked as resolved and limited conversation to collaborators
on Oct 11, 2022
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsFuture bugs/improvements

Steps to Reproduce
Can repro from 1.17 to 1.23 master.
Run https://github.com/AlexV525/flutter_test_app (test-assets-conflict-page) for repro demo with master.
assets/a.pngandassets/b/a.png)Expected results: Display two different pictures/assets.
Actual results: Displayed same pictures/assets, which is the deeper one.