MPDirectionsRendererOptions class
Style and behaviour options for a rendered route.
Every property is optional, and null means unset. Only the properties you set are sent to the native SDK, so unset properties keep inheriting the solution-level wayfinding style configured in the MapsIndoors CMS, or the SDK's built-in default when the solution configures nothing.
MPDirectionsRenderer.setOptions replaces the previous runtime override rather than merging into it. To change one property of an override you already applied, read it back and copy it:
final current = await renderer.getOptions() ?? const MPDirectionsRendererOptions();
await renderer.setOptions(current.copyWith(strokeColor: Colors.red));
Use MPDirectionsRenderer.clearOptions to drop the runtime override entirely and fall back to the CMS style again.
Things worth knowing
- Colour alpha is ignored. Only the RGB channels of a Color are sent. Use strokeOpacity, haloOpacity and animatedOverlayOpacity instead.
- Setting any animation property replaces the whole CMS animation block on Android. animationType, animationSpeed, animationMinDuration, forceAnimation and the
animatedOverlay*properties travel together, so setting one of them means the others fall back to their built-in defaults rather than to the CMS values. Set all the animation properties you care about in the same call. The line and halo properties do not behave this way — those merge with the CMS style field by field. - fitBounds and fitBoundsPadding are iOS only and are ignored on Android.
- Halo defaults differ between the Android map engines. With Mapbox the halo is drawn unless it is explicitly disabled; with Google Maps it is drawn only when it is explicitly enabled. Set haloEnabled explicitly whenever the halo matters.
- MPStrokeStyle.dashed falls back to MPStrokeStyle.solid on Google Maps on iOS, which has no native dashed-line primitive.
- Inheritance
-
- Object
- MapsIndoorsObject
- MPDirectionsRendererOptions
Constructors
- MPDirectionsRendererOptions({Color? strokeColor, double? strokeOpacity, double? strokeWeight, MPStrokeStyle? strokeStyle, bool? haloEnabled, Color? haloColor, double? haloOpacity, double? haloWeight, MPRouteAnimationType? animationType, double? animationSpeed, double? animationMinDuration, bool? animationRepeating, bool? forceAnimation, Color? animatedOverlayColor, double? animatedOverlayOpacity, double? animatedOverlayWeight, bool? fitBounds, double? fitBoundsMaxZoom, EdgeInsets? fitBoundsPadding})
-
Creates a set of renderer options. Every property is optional, and the ones left out keep inheriting the CMS or built-in style.
const
Properties
- animatedOverlayColor → Color?
-
The colour of the animated overlay drawn on top of the base line. Alpha is ignored, use animatedOverlayOpacity.
final
- animatedOverlayOpacity → double?
-
The opacity of the animated overlay, from 0.0 to 1.0.
final
- animatedOverlayWeight → double?
-
The width of the animated overlay, in points (iOS) or density-independent pixels (Android).
final
- animationMinDuration → double?
-
The shortest the animated overlay may take to cover a route, in seconds.
final
- animationRepeating → bool?
-
Whether the animated overlay restarts once it reaches the end of the route.
final
- animationSpeed → double?
-
The speed of the animated overlay.
final
- animationType → MPRouteAnimationType?
-
The animation drawn on top of the base line.
final
- fitBounds → bool?
-
Whether the camera moves to fit the route when it is rendered.
final
- fitBoundsMaxZoom → double?
-
The closest the camera may zoom in when fitting the route.
final
- fitBoundsPadding → EdgeInsets?
-
The padding left around the route when fitting the camera to it.
final
- forceAnimation → bool?
-
Whether to animate the route even when the operating system reports that the user prefers reduced motion.
final
- haloColor → Color?
-
The colour of the halo. Alpha is ignored, use haloOpacity.
final
- haloEnabled → bool?
-
Whether to draw a halo (an outline, or casing) behind the base line.
final
- haloOpacity → double?
-
The opacity of the halo, from 0.0 to 1.0.
final
- haloWeight → double?
-
The width of the halo, in points (iOS) or density-independent pixels (Android). This is the width added on each side of the base line.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strokeColor → Color?
-
The colour of the always-visible base line. Alpha is ignored, use strokeOpacity.
final
- strokeOpacity → double?
-
The opacity of the base line, from 0.0 to 1.0.
final
- strokeStyle → MPStrokeStyle?
-
The stroke pattern of the base line.
final
- strokeWeight → double?
-
The width of the base line, in points (iOS) or density-independent pixels (Android).
final
Methods
-
copyWith(
{Color? strokeColor, double? strokeOpacity, double? strokeWeight, MPStrokeStyle? strokeStyle, bool? haloEnabled, Color? haloColor, double? haloOpacity, double? haloWeight, MPRouteAnimationType? animationType, double? animationSpeed, double? animationMinDuration, bool? animationRepeating, bool? forceAnimation, Color? animatedOverlayColor, double? animatedOverlayOpacity, double? animatedOverlayWeight, bool? fitBounds, double? fitBoundsMaxZoom, EdgeInsets? fitBoundsPadding}) → MPDirectionsRendererOptions - Returns a copy of these options with the given properties replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Converts the options to a JSON representation that can be parsed by the MapsIndoors Platform SDKs.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
fromJson(
dynamic json) → MPDirectionsRendererOptions? - Attempts to build a MPDirectionsRendererOptions from a JSON object, this method will decode the object if needed