0

How to add flutter map BitmapDescription size ?

controller.addMarker(
  MarkerOptions(
    position: LatLng(mapLat, mapLng),
    infoWindowText: InfoWindowText("Title", "Content"),
    //icon: BitmapDescriptor.fromAsset('assets/carfront.png'),
     icon: BitmapDescriptor.fromAsset('assets/carfront.png',width:45.0,height:45.0),
  )
);

1 Answer 1

2

There is an open issue around this problem https://github.com/flutter/flutter/issues/24865, that will not allow you to change it programmatically

just simply change the size of the asset.

Also if you want to show different size asset on iOS vs android you will have something like this:

BitmapDescriptor get carIcon {
  bool isIOS = Theme.of(context).platform == TargetPlatform.iOS;
  if (isIOS)
    return BitmapDescriptor.fromAsset('assets/carfront.png');
  else
    return BitmapDescriptor.fromAsset(
        'assets/androidcarfront.png');
} 
1
  • Yea It's working ok But I want to programatic solution Commented Mar 5, 2019 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.