Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 590
Mavro Avatar asked Feb 24 '19 19:02

Mavro


People also ask

How do I get rid of the zoom button on Google Maps flutter?

If anyone want to remove zoom control. Add zoomControlsEnabled: false to google map view.

How do I remove a marker from a Google map in flutter?

You need to find that specific marker in your _markers list (e.g. by firstWhere()) and then remove it from the list of markers. Edit: Marker marker = _markers.

How do I hide a marker on Google Maps?

Step 1 Go to Add or Edit Map and Scroll down to the 'Infowindow Settings' section. Step 2 Enable the box of 'Hide Markers on Page Load' option. Step 3 Click on Save Map and open it in browser.


2 Answers

[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.

like image 134
Samir Dangal Avatar answered Sep 20 '22 16:09

Samir Dangal


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.

like image 28
vovahost Avatar answered Sep 19 '22 16:09

vovahost