I need to make resolution resolution-aware images (BitmapDescriptor)
static Future<BitmapDescriptor> makeBitmapDescriptor(
String path, BuildContext context) {
return BitmapDescriptor.fromAssetImage(
ImageConfiguration(devicePixelRatio: MediaQuery.of(context).devicePixelRatio,
path,
);
}
& for that I need the devicePixelRatio, is there a way to get it without the BuildContext
& MediaQuery.of(context).devicePixelRatio
?
You can use fromWindow
like this:
MediaQueryData.fromWindow(WidgetsBinding.instance.window).devicePixelRatio;
Collected from the Internet
Please contact javaer1[email protected] to delete if infringement.
Comments