Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove bottom right button from google maps flutter

There is a button in the bottom right of the google maps API google maps widget. I never added this button myself. How do I remove it?

Bottom Right button

edit: here is my code

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("TravelBuddy"),
      ),
      body: Stack(
        children: <Widget>[
          GoogleMap(
            onMapCreated: _onMapCreated,
            initialCameraPosition: 
              CameraPosition(
              target: _center,
              zoom: 11.0,
              ),
            mapType: _currentMapType,
            markers: _markers,
            onCameraMove: _onCameraMove,
          ),
          Padding(
            padding: EdgeInsets.all(16.0),
            child:  Align(
              alignment: Alignment.topRight,
              child: Column(
                children: <Widget>[
                  button(_onMapTypeButtonPressed, Icons.map),
                  SizedBox(height: 16.0),
                  button(_onAddMarkerButtonPressed, Icons.add_location),
                  SizedBox(height: 16.0),
                  button(_goToPosition1, Icons.location_searching),
     ],),),),],),);}
like image 408
joshLor Avatar asked Jul 04 '19 01:07

joshLor


People also ask

How do I remove a button from Google Maps?

You may wish to turn off the API's default UI buttons entirely. To do so, set the map's disableDefaultUI property (within the MapOptions object) to true . This property disables any UI control buttons from the Maps JavaScript API.

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. firstWhere((marker) => marker.

How to remove zoom button in google maps flutter?

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


2 Answers

Thanks for the code.

Try putting an option "my LocationButtonEnabled" in GoogleMap() widget

     GoogleMap(
            onMapCreated: _onMapCreated,
            initialCameraPosition: 
              CameraPosition(
              target: _center,
              zoom: 11.0,
              ),
            mapType: _currentMapType,
            markers: _markers,
            onCameraMove: _onCameraMove,
            myLocationButtonEnabled: false,
            options: GoogleMapOptions(
              myLocationEnabled:true
              //there is a lot more options you can add here
            )
          ),
like image 132
FadhliS Avatar answered Oct 25 '22 12:10

FadhliS


I had a similar problem. Adding 'zoomControlsEnabled: false,' in the GoogleMap() widget worked for me.

like image 4
Isaac Chambers Avatar answered Oct 25 '22 10:10

Isaac Chambers