How to change moving location icon using google maps in flutter - flutter

please help me I am new in the flutter
GoogleMap(
padding: EdgeInsets.only(
top: mapBottomPadding,
),
initialCameraPosition: _kGoogle,
mapToolbarEnabled: true,
buildingsEnabled: true,
myLocationButtonEnabled: true,
myLocationEnabled: true,
mapType: MapType.terrain,
markers: markers,
trafficEnabled: true,
// on below line setting compass enabled.
compassEnabled: true,
onMapCreated: onMapcreated,
zoomControlsEnabled: true,
),
i also shared my google maps code

You can use this code snippet for google maps change moving location iconhttps://gist.github.com/samuchakraborty/243842a1a93956e64dc8781d0f9fb313

Related

GoogleMaps Flutter Exceeded sample count in FrameTime Log

Hey when adding GoogleMaps to my project, it seems that anytime the map is dragged or the camera is moved there is a spam of logs for
I/Counters( 4961): exceeded sample count in FrameTime
This seems to be a common issue with GoogleMaps in flutter reported here.
Here and Here
P.S. Setting myLocationEnabled: false, will not solve the issue as this still occurs when manually moving the map
class MyMap extends StatelessWidget {
const MyMap({
Key? key,
}) : super(key: key);
#override
Widget build(BuildContext context) {
return GoogleMap(
initialCameraPosition: CameraPosition(
target: state.location ?? const LatLng(0, 0),
zoom: 15.0,
),
mapType: MapType.normal,
myLocationEnabled: false,
zoomGesturesEnabled: true,
scrollGesturesEnabled: true,
tiltGesturesEnabled: false,
rotateGesturesEnabled: true,
zoomControlsEnabled: false,
);
}
}
Does anyone know if there is an update on the best way to fix this?
Thanks
delete some layers from widget google maps flutter
myLocationEnabled: false,
zoomGesturesEnabled: true,
scrollGesturesEnabled: true,
tiltGesturesEnabled: false,
rotateGesturesEnabled: true,
zoomControlsEnabled: false,

How to add GeoJson file to Google Maps Flutter as a layer

I am doing a project that allows a user to upload a geojson file and add the polygons/polylines to the Google Map as a layer.
To be clear I'm using google_maps_flutter package: https://pub.dev/packages/google_maps_flutter
GoogleMap(
myLocationButtonEnabled: true,
mapType: _currentMapType,
zoomGesturesEnabled: true,
compassEnabled: true,
myLocationEnabled: true,
gestureRecognizers: Set()
..add(Factory<EagerGestureRecognizer>(
() => EagerGestureRecognizer())),
zoomControlsEnabled: true,
initialCameraPosition: cameraPosition ?? _defaultCameraPosition,
onMapCreated: (controller) {
_controllerGoogleMap.complete(controller);
_googleMapController = controller;
_determinePosition();
},
markers: _markers),
However, while trying to implement this, I did not find a clear way to implement this. What ways can I use to do this?
Any help will be appreciated. Thanks

How to make draggable circle google map in flutter

I am trying to make draggable circle in google maps in flutter but i don't know how to do that?
How can i do it in flutter?
I have the circle on google map
widget but i can't drag it
Set<Circle> circles = Set.from([Circle(
circleId: CircleId(id),
center: LatLng(latitude, longitude),
radius: 4000,
)]);
GoogleMap(
mapType: MapType.normal,
myLocationEnabled: true,
myLocationButtonEnabled: true,
initialCameraPosition: initialMapLocation,
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
},
onCameraMove: null,
circles: circles,
);
please look at this Question and answer . for Drag and Resize a View
https://stackoverflow.com/a/63954279/6813907

Flutter google_maps_flutter not show location button even if myLocationButtonEnabled is set to true

i am new in flutter and i'm build a simple app with google_map_flutter package.
I understand that the first time the location button is not showed due to location permission. I would like to update the state of the location button to true once the user grant the permission. below the code.
children: [
GoogleMap(
padding: EdgeInsets.only(bottom: _bottomPaddingOfMap, top: 32),
mapType: MapType.normal,
myLocationButtonEnabled: _myLocationButtonEnabled,
initialCameraPosition: _kGooglePlex,
myLocationEnabled: true,
zoomGesturesEnabled: true,
zoomControlsEnabled: true,
onMapCreated: (GoogleMapController controller) {
_controllerGoogleMap.complete(controller);
newGoogleMapController = controller;
setState(() {
//..... update _myLocationButtonEnabled??
_bottomPaddingOfMap = 280.0;
});
locatePosition();
},
),....
I'm using a permission_handler package but not sure about how to use it. I guess I've to update the _myLocationButtonEnabled variable to true once user granted permission.
How can I do this?
Any help will be appreciated.
Thanks guys.

Google Maps Flutter Gestures Three finger swipe

I am using google maps flutter plugin for my flutter mobile app. It works fine but when i take a screenshot of the map using three fingers vertical swipe across the screen (As is the gesture for all/most Redmi Phones), the map then stops responding to any gesture at all (scrolling, zooming, etc. nothing works). It stays frozen until i reload the page. I have added some gestures like
body: GoogleMap(
initialCameraPosition: CameraPosition(
target: LatLng(lat,long ), zoom: 12),
myLocationEnabled: true,
tiltGesturesEnabled: true,
compassEnabled: true,
scrollGesturesEnabled: true,
zoomGesturesEnabled: true,
onMapCreated: _onMapCreated,
markers: Set<Marker>.of(markers.values),
gestureRecognizers: Set()
..add(Factory<PanGestureRecognizer>(() => PanGestureRecognizer()))
..add(Factory<ScaleGestureRecognizer>(() => ScaleGestureRecognizer()))
..add(Factory<TapGestureRecognizer>(() => TapGestureRecognizer()))
..add(Factory<VerticalDragGestureRecognizer>(
() => VerticalDragGestureRecognizer())
),