Compass and My location button position on map in flutter

5,055

for the latest version of google_maps_flutter, you can always disable the compass and my location buttons and make your own one by positioning them with Stack

GoogleMap googleMap = GoogleMap(
      onMapCreated: onMapCreated,
      compassEnabled: _compassEnabled,
      myLocationButtonEnabled: _myLocationButtonEnabled,
    );

use location or geolocator for customized compass heading and current location information

Share:
5,055
Farhana Naaz Ansari
Author by

Farhana Naaz Ansari

Updated on December 15, 2022

Comments

  • Farhana Naaz Ansari
    Farhana Naaz Ansari over 1 year

    I want to do repositioning of Compass and Location Button on GoogleMap and tried to give position to them by adding padding on map but not works.It always shows on the top of Map and haven't found the way to position them. here

    My Google Map code:

              Stack(
                  children: <Widget>[
                GoogleMap(
                  padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
                  myLocationEnabled: true,
                  compassEnabled:true,
                  onMapCreated: _onMapCreated,
                  initialCameraPosition: CameraPosition(
                    target: LatLng(mylat, mylan),
                    zoom: 7.0,
                  ),
                  markers: _markers.values.toSet(),
                  polylines: Set<Polyline>.of(polylines.values),
                ),
                searchContainer(),
              ],
            ),
    

    Goole Map Screeshot