Flutter 颤振:每个设备的devicePixelRatio为1.0

Flutter 颤振:每个设备的devicePixelRatio为1.0,flutter,dart,flutter-layout,Flutter,Dart,Flutter Layout,我正在尝试为不同屏幕大小的设备使用不同的图标(大小不同) 当我尝试这个代码时 print('devicepr:${ViewConfiguration().devicePixelRatio}'),我每次都得到1.0 因此,本文提供的解决方案不适合我 以下是我用来实现目标的代码: Image( image: AssetImage( isSelected ? selectedPath : path, ),

我正在尝试为不同屏幕大小的设备使用不同的图标(大小不同)

当我尝试这个代码时
print('devicepr:${ViewConfiguration().devicePixelRatio}'),我每次都得到1.0

因此,本文提供的解决方案不适合我

以下是我用来实现目标的代码:


    Image(
              image: AssetImage(
                isSelected ? selectedPath : path,
              ),
              height: isSelected ? 40 : 25,
              width: isSelected ? 40 : 25,
            ),

我猜是因为对于Nexus S、Nexus 4、Nexus 6、Galaxy Nexus,devicePixelRatio是1.0,加载了相同的基本图标/图像,其余的则没有

你能帮我渡过难关吗?短暂性脑缺血发作