Animarker class

Google Maps widget wrapper for location, angle and ripple animation on map canvas The basic setup for using Animarker for Google Maps

Animarker(
  mapId: _controller.future.then<int>((value) => value.mapId),
  child: GoogleMap(
    ...
    onMapCreated: (controller) => _controller.complete(controller),
    onCameraMove: (ca) => setState(() => zoom = ca.zoom),
    ...
  ),
)

New location updates are push it to a First-in, first-out queue (FIFO) that pops the next location in the queue when current running animation ends until clears the queue.

Since Location interpolation requires two polar position begin (latitude, longitude), end (latitude, longitude) When first location is push it to queue the animation doesn't start until a second location is pushed begin, end

If both begin and end location are equal it means that marker is stopped

Inheritance
Available Extensions
Annotations

Constructors

Animarker({Key? key, required Widget child, required Future<int> mapId, Curve curve = Curves.linear, OnStopover? onStopover, dynamic onMarkerAnimationListener(Marker)?, double zoom = 15.0, double rippleRadius = 0.5, int runExpressAfter = 10, double angleThreshold = 1.5, bool useRotation = true, Duration rippleIdleAfter = const Duration(seconds: 30), bool isActiveTrip = true, Color rippleColor = Colors.red, Set<Marker> markers = const <Marker>{}, Duration duration = const Duration(milliseconds: 1000), Duration rippleDuration = const Duration(milliseconds: 2000), bool shouldAnimateCamera = true})

Properties

angleThreshold double
Set the tolerance to skip consecutive Location value in the queue running in the same direction:
final
child Widget
The Google Maps Widget as child
final
curve Curve
Animation Curve
final
duration Duration
The length of time this geo-animation should last
final
hashCode int
The hash code for this object.
no setterinherited
isActiveTrip bool
Control if should accept new location changes or ends the current trip
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
mapId Future<int>
Save the mapId from Google Maps widget related to this Animarker widget. This value is used underlying for the Native Google Maps Platform
final
markers Set<Marker>
Literally, a Set of markers provided to the Animarker widget. All the elements shouldn't be duplicated. The MarkerId should be unique at the set, duplicated MarkerIds would led to an error
final
onMarkerAnimationListener → (dynamic Function(Marker)?)
Callback called when animation is in progress: Given P1,P2 locations, when the animation is in progress betweeen Point P1 and P2, this listener will be called to give latest value
final
onStopover OnStopover?
Callback called when final state of the animation is reach: Given P1,P2 locations, when the animation reach the P2 point the callback is called making a stop (t = 1.0).
final
rippleColor Color
The color of ripple rings
final
rippleDuration Duration
The length of time this ripple animation should last
final
rippleIdleAfter Duration
Set the Ripple effect idle/stop after the defined timeout from this property, preventing ripple forever if the location doesn't change
final
rippleRadius double
Control the ripple radius size taking the screen width as constraints
final
runExpressAfter int
First of all, let's explain how the location interpolation is done: since it's required a begin location and end location to geo-interpolate between them, the animation lasts according to the indicated duration. Meanwhile, when animation is running new location updates could be pushed to Location Queue, making it larger and larger and increasing the distance and delay between current animating location and real user one.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldAnimateCamera bool
Prevent Google Maps camera to be control by the Animarker Setting this flag to false won't change the map position when location change.
final
useRotation bool
Let you enable/disable Marker rotation: The rotation, also known as bearing/heading, are the angle between two locations and indicate the course or direction from one to another.
final
zoom double
Google Maps' zoom: require for scale the ripple radius depending on zoom Preventing, this way, a huge ripple size using a fixed radius when zoom changes
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() AnimarkerState
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