How to change the icon size of Google Maps marker in Flutter?

前端 未结 14 755
不知归路
不知归路 2020-12-07 12:32

I am using google_maps_flutter in my flutter app to use google map I have custom marker icon and I load this with BitmapDescriptor.fromAsset(\"images/car.

14条回答
  •  隐瞒了意图╮
    2020-12-07 13:30

    Try BitmapDescriptor.fromAssetImage. It will ignore the image size as well.

    BitmapDescriptor.fromAssetImage(
                ImageConfiguration(size: Size(32, 32)), 'assets/car.png')
            .then((onValue) {
          setState(() {
            markerIcon = onValue;
          });
        });
    

    Also using default configuration fails.

    loadMarkerImage(BuildContext context) {
        var config = createLocalImageConfiguration(context, size: Size(30, 30));
        BitmapDescriptor.fromAssetImage(config, 'assets/car.png')
            .then((onValue) {
          setState(() {
            markerIcon = onValue;
          });
        });
      }
    

提交回复
热议问题