GoogleMapsWidget class

A GoogleMapsWidget which can be used to make polylines(route) from a source to a destination, and also handle a driver's realtime location (if any) on the map.

Inheritance

Constructors

GoogleMapsWidget({Key? key, required String apiKey, required LatLng sourceLatLng, required LatLng destinationLatLng, void totalDistanceCallback(String?)?, void totalTimeCallback(String?)?, void onMapCreated(GoogleMapController)?, MarkerIconInfo? sourceMarkerIconInfo, MarkerIconInfo? destinationMarkerIconInfo, MarkerIconInfo? driverMarkerIconInfo, void onTapSourceMarker(LatLng)?, void onTapDestinationMarker(LatLng)?, void onTapDriverMarker(LatLng)?, void onTapSourceInfoWindow(LatLng)?, void onTapDestinationInfoWindow(LatLng)?, void onTapDriverInfoWindow(LatLng)?, Stream<LatLng>? driverCoordinatesStream, LatLng? defaultCameraLocation, Set<Marker> markers = const <Marker>{}, Set<Polyline> polylines = const <Polyline>{}, bool showPolyline = true, bool showSourceMarker = true, bool showDestinationMarker = true, bool showDriverMarker = true, double defaultCameraZoom = Constants.DEFAULT_CAMERA_ZOOM, String sourceName = Constants.DEFAULT_SOURCE_NAME, String destinationName = Constants.DEFAULT_DESTINATION_NAME, String driverName = Constants.DEFAULT_DRIVER_NAME, Color routeColor = Constants.ROUTE_COLOR, int routeWidth = Constants.ROUTE_WIDTH, Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers = const <Factory<OneSequenceGestureRecognizer>>{}, bool compassEnabled = true, bool mapToolbarEnabled = true, CameraTargetBounds cameraTargetBounds = CameraTargetBounds.unbounded, MapType mapType = MapType.normal, MinMaxZoomPreference minMaxZoomPreference = MinMaxZoomPreference.unbounded, bool rotateGesturesEnabled = true, bool scrollGesturesEnabled = true, bool zoomControlsEnabled = true, bool zoomGesturesEnabled = true, bool liteModeEnabled = false, bool tiltGesturesEnabled = true, bool myLocationEnabled = false, bool myLocationButtonEnabled = true, EdgeInsets padding = const EdgeInsets.all(0), bool indoorViewEnabled = false, bool trafficEnabled = false, bool buildingsEnabled = true, Set<Polygon> polygons = const <Polygon>{}, Set<Circle> circles = const <Circle>{}, VoidCallback? onCameraMoveStarted, Set<TileOverlay> tileOverlays = const <TileOverlay>{}, CameraPositionCallback? onCameraMove, VoidCallback? onCameraIdle, ArgumentCallback<LatLng>? onTap, ArgumentCallback<LatLng>? onLongPress})
const

Properties

apiKey String
Google Maps API Key.
final
buildingsEnabled bool
Enables or disables showing 3D buildings where available
final
cameraTargetBounds CameraTargetBounds
Geographical bounding box for the camera target.
final
circles Set<Circle>
Circles to be placed on the map.
final
compassEnabled bool
True if the map should show a compass when rotated.
final
defaultCameraLocation LatLng?
The initial location of the map's camera. If null, initial location is sourceLatLng.
final
defaultCameraZoom double
The initial zoom of the map's camera. Defaults to Constants.DEFAULT_CAMERA_ZOOM.
final
destinationLatLng LatLng
The destination LatLng.
final
destinationMarkerIconInfo MarkerIconInfo?
The marker which is rendered on the location destinationLatLng.
final
destinationName String
Displays destination Marker's InfoWindow displaying destinationName when tapped on destinationMarkerIconInfo. Defaults to Constants.DEFAULT_DESTINATION_NAME.
final
driverCoordinatesStream Stream<LatLng>?
A Stream of LatLng objects for the driver used to render driverMarkerIconInfo on the map with the provided LatLng objects.
final
driverMarkerIconInfo MarkerIconInfo?
The marker which is rendered on the driver's current location provided by driverCoordinatesStream.
final
driverName String
Displays driver's Marker's InfoWindow displaying driverName when tapped on driverMarkerIconInfo. Defaults to Constants.DEFAULT_DRIVER_NAME.
final
gestureRecognizers Set<Factory<OneSequenceGestureRecognizer>>
Which gestures should be consumed by the map.
final
hashCode int
The hash code for this object.
no setterinherited
indoorViewEnabled bool
Enables or disables the indoor view from the map
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
liteModeEnabled bool
True if the map view should be in lite mode. Android only.
final
mapToolbarEnabled bool
True if the map should show a toolbar when you interact with the map. Android only.
final
mapType MapType
Type of map tiles to be rendered.
final
markers Set<Marker>
Markers to be placed on the map. (apart from the source and destination markers).
final
minMaxZoomPreference MinMaxZoomPreference
Preferred bounds for the camera zoom level.
final
myLocationButtonEnabled bool
Enables or disables the my-location button.
final
myLocationEnabled bool
True if a "My Location" layer should be shown on the map.
final
onCameraIdle VoidCallback?
Called when camera movement has ended, there are no pending animations and the user has stopped interacting with the map.
final
onCameraMove CameraPositionCallback?
Called repeatedly as the camera continues to move after an onCameraMoveStarted call.
final
onCameraMoveStarted VoidCallback?
Called when the camera starts moving.
final
onLongPress ArgumentCallback<LatLng>?
Called every time a GoogleMap is long pressed.
final
onMapCreated → (void Function(GoogleMapController)?)
Callback method for when the map is ready to be used.
final
onTap ArgumentCallback<LatLng>?
Called every time a GoogleMap is tapped.
final
onTapDestinationInfoWindow → (void Function(LatLng)?)
Called every time destination Marker's InfoWindow is tapped.
final
onTapDestinationMarker → (void Function(LatLng)?)
Called every time destination Marker is tapped.
final
onTapDriverInfoWindow → (void Function(LatLng)?)
Called every time driver Marker's InfoWindow is tapped.
final
onTapDriverMarker → (void Function(LatLng)?)
Called every time driver Marker is tapped.
final
onTapSourceInfoWindow → (void Function(LatLng)?)
Called every time source Marker's InfoWindow is tapped.
final
onTapSourceMarker → (void Function(LatLng)?)
Called every time source Marker is tapped.
final
padding EdgeInsets
Padding to be set on map. See https://developers.google.com/maps/documentation/android-sdk/map#map_padding for more details.
final
polygons Set<Polygon>
Polygons to be placed on the map.
final
polylines Set<Polyline>
Polylines to be placed on the map. (apart from the one generated between the sourceLatLng and the destinationLatLng.
final
rotateGesturesEnabled bool
////////////////////////////////////////////// ////////////////////////////////////////////// True if the map view should respond to rotate gestures.
final
routeColor Color
Color of the route made between sourceLatLng and destinationLatLng. Defaults to Constants.ROUTE_COLOR.
final
routeWidth int
Width of the route made between sourceLatLng and destinationLatLng. Defaults to Constants.ROUTE_WIDTH.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollGesturesEnabled bool
True if the map view should respond to scroll gestures.
final
showDestinationMarker bool
Whether to show the destination marker at destinationLatLng.
final
showDriverMarker bool
Whether to show the driver marker.
final
showPolyline bool
Whether to show the generated polyline from sourceLatLng to destinationLatLng.
final
showSourceMarker bool
Whether to show the source marker at sourceLatLng.
final
sourceLatLng LatLng
The source LatLng.
final
sourceMarkerIconInfo MarkerIconInfo?
The marker which is rendered on the location sourceLatLng.
final
sourceName String
Displays source Marker's InfoWindow displaying sourceName when tapped on sourceMarkerIconInfo. Defaults to Constants.DEFAULT_SOURCE_NAME.
final
tileOverlays Set<TileOverlay>
Tile overlays to be placed on the map.
final
tiltGesturesEnabled bool
True if the map view should respond to tilt gestures.
final
totalDistanceCallback → (void Function(String?)?)
Called after polylines are created for the given sourceLatLng and destinationLatLng and totalDistance is initialized.
final
totalTimeCallback → (void Function(String?)?)
Called after polylines are created for the given sourceLatLng and destinationLatLng and totalTime is initialized.
final
trafficEnabled bool
Enables or disables the traffic layer of the map
final
zoomControlsEnabled bool
True if the map view should show zoom controls. This includes two buttons to zoom in and zoom out. The default value is to show zoom controls.
final
zoomGesturesEnabled bool
True if the map view should respond to zoom gestures.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _GoogleMapsWidgetState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited