Mavro
Mavro

Reputation: 179

How to disable navigation buttons that appear when tapped a marker in Google maps with Flutter 1.0?

Directions Buttons

I want to remove those buttons because I want to put the route implementation when I tap a button inside a Bottom sheet widget. My other question is, how Can I use the routes in Google maps inside my App and not redirected to Google maps? Do I need to enable the Routes API?

This is the same question in Android. Android google maps marker disable navigation option

Upvotes: 18

Views: 16918

Answers (2)

Samir Dangal
Samir Dangal

Reputation: 2830

[google_maps_flutter] Support enable/disable MapToolbar.

Add this line inside your GoogleMap widget to enable or disable MapToolbar.

GoogleMap(

mapToolbarEnabled: false,

)

PS : consumeTapEvents: true, stops recentering the map and marker's InfoWindow.

Upvotes: 26

vovahost
vovahost

Reputation: 36007

When Creating a Marker set consumeTapEvents to true.

Marker(
    markerId: MarkerId('0'),
    icon: BitmapDescriptor.defaultMarker,
    position: LatLng(51.522522, -0.141198),
    consumeTapEvents: true
);

Tested on google_maps_flutter: 0.5.16 with Flutter v1.7.3

From consumeTapEvents docs

True if the marker icon consumes tap events. If not, the map will perform default tap handling by centering the map on the marker and displaying its info window.

Upvotes: 8

Related Questions