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
Image.asset determines scale of asset based on whether path contains 3.0x #17241
Actual behavior: whenever a path to a file contains "3.0x" it will be displayed as a xxhdpi (3x) high resolution image
Expected behavior: must pay close attention to what the app developer specified in pubspec.yaml. Not doing so may compromise introducing other kinds of variants in the future.
new Image.asset('assets/3.0x/yetAnotherFolder/hackyAsset.png'),
or
new Image.asset('assets/3.0x/ic_accessibility_black_36dp.png'),
expected behavior: They should behave like mdpi (1x) images
actual behavior: They behave like xxhdpi (3x) hi-res image
There are 2 pitfalls here. The obvious one is that path assets/3.0x/yetAnotherFolder doesn't comply with the specs that the main file sits on <folder> and the variant sits on <folder>/3.0x. The second is that the intention of the app developer may have been putting a mdpi (1x) file on assets/3.0x/ic_accessibility_black_36dp.png .
I like how smart it is, but a) this is clashing with what AssetManifest.json says. And b) I'm afraid that one day other types of variants (say screen size, localization...) will make pre-existing apps break because they'll start treating its main variant assets as non-main variants. In any case I can't be sure if this is a feature or a bug. I'd like to help document it properly if it's the former or fix it if it's the latter.
I'm terribly bad at regular expressions or else I'd already have changed it in image_resolution.dart. Anyway, the new unit tests included in above commit should be a good conversation started to get everybody on the same page on this problem.
Also removed puzzling lines from gallery's pubspec, I built app and it's still working.
@HansMuller as long as we're in the business of problem solving (not blame assigning) that's just a hiccup :)
I'm still not confident I understand all the intentions behind asset image ratios but I tried to enforce my own understanding of it with unit tests and a small fix on #17322. I'd suggest reading the comments before the code, I hope the clarification is clear enough (no pun intended)
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
fmatosqg commentedon May 3, 2018
Inspecting
pubspec.yamlfor flutter gallery I got a bit more confused:I would expect this
tvolkert commentedon May 3, 2018
Yeah me too. @HansMuller do the variants need to be explicitly listed?
fmatosqg commentedon May 4, 2018
I'm terribly bad at regular expressions or else I'd already have changed it in
image_resolution.dart. Anyway, the new unit tests included in above commit should be a good conversation started to get everybody on the same page on this problem.Also removed puzzling lines from gallery's pubspec, I built app and it's still working.
HansMuller commentedon May 4, 2018
@fmatosqg you are correct about the white_logo gallery asset variants. Sorry about that, my fault.
fmatosqg commentedon May 5, 2018
@HansMuller as long as we're in the business of problem solving (not blame assigning) that's just a hiccup :)
I'm still not confident I understand all the intentions behind asset image ratios but I tried to enforce my own understanding of it with unit tests and a small fix on #17322. I'd suggest reading the comments before the code, I hope the clarification is clear enough (no pun intended)
Make image resolution more strict, clean gallery pubspec.yaml (flutte…
Make image resolution more strict, clean gallery pubspec.yaml (flutte…
Code review - write more tests and revert to previous public api (flu…
Make image resolution more strict, clean gallery pubspec.yaml (#17241) (
tvolkert commentedon May 29, 2018
It looks like this was closed by #17322 - feel free to re-open if there's more to do here.
fmatosqg commentedon May 29, 2018
That's right, #17322 completely covers this issue.
cafa097 Revert "Roll src/third_party/dart ba8baa46b452..fbd0c8a46813 …
cafa097 Revert "Roll src/third_party/dart ba8baa46b452..fbd0c8a46813 …
flutter-team-archive/engine@2d42c74...d7ad50c
flutter-team-archive/engine@2d42c74...d7ad50c
cafa097 Revert "Roll src/third_party/dart ba8baa46b452..fbd0c8a46813 …
github-actions commentedon Sep 3, 2021
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.