I have an image I'm trying to display based on the device pixel ratio.
But the app just keeps using the 1.0x version of the image.
In my project's directory I have the structure
assets
tablet
graphics
0.5x
image.png
2.0x
image.png
4.0x
image.png
image.png
The code I have is (partially psuedo)
Expanded(
Row(
children: [
const Expanded(
child: Padding(
child: Image(
image: AssetImage('assets/tablet/graphics/image.png')
)
)
)
]
)
)
The pubspec.yaml I have tried
assets/tablet/graphics
Then
assets/tablet/graphics/image.png
Then
assets/tablet/graphics/image.png
assets/tablet/graphics/0.5x/image.png
assets/tablet/graphics/2.0x/image.png
assets/tablet/graphics/4.0x/image.png
But nothing works. It only displays the 1.0x unless I specify to use the 2.0x by putting it's path. I did a test with the console to confirm the device's density pixel ratio is 2.0x, not 1.0x.
I've also used Image.asset it's the same result. Yes everything is within a MaterialApp
The 2.0x device I'm simulating on is the iPad Pro 5th gen.
I tried using the package: specification for the AssetImage because they are nested, but I'm not sure if I did it right. Maybe that's the issue? Thanks