Loading...
Searching...
No Matches
UserLocationLayer Class Referenceabstract

Layer that automatically renders current user position (arrow and accuracy circle) on the map. Provides visibility and anchoring controls. Referenced from LocationView. More...

Inherits Finalizable.

Public Member Functions

void setVisible (bool visible)
 Shows or hides user location layer.
 
bool isVisible ()
 Returns true if user location layer is visible.
 
void setAnchor (math.Point< double > anchor)
 Sets anchor point for user indicator in screen pixels.
 
void resetAnchor ()
 Resets anchor to default (center).
 
bool anchorEnabled ()
 Returns true if custom anchor is enabled.
 
void setHeadingModeActive (bool active)
 Enables or disables heading-up mode while the user location layer is anchored.
 
bool headingModeActive ()
 Returns true if heading-up mode is enabled. Same as followMode() == HEADING.
 
void setFollowMode (UserLocationFollowMode mode)
 Sets how the camera follows the user. NONE stops following and keeps a previously set anchor point. POSITION, HEADING and COURSE follow even without setAnchor (screen center). setAnchor() from NONE switches to POSITION. resetAnchor() switches to NONE. setHeadingModeActive(true) switches to HEADING.
 
UserLocationFollowMode followMode ()
 Returns the current follow mode.
 
void setArrowBitmap (ImageProvider? bitmap)
 Replaces the heading arrow bitmap. Null restores the built-in heading fan.
 
void setAccuracyColor (Color color)
 Sets the accuracy-circle fill. Default is a translucent blue.
 
bool isValid ()
 

Detailed Description

Layer that automatically renders current user position (arrow and accuracy circle) on the map. Provides visibility and anchoring controls. Referenced from LocationView.

Definition at line 27 of file user_location_layer.dart.

Member Function Documentation

◆ anchorEnabled()

bool UserLocationLayer.anchorEnabled ( )

Returns true if custom anchor is enabled.

Dart code snippet:

bool anchorEnabled = _userLocationLayer!.anchorEnabled();
print("Anchor enabled: $anchorEnabled");

◆ followMode()

UserLocationFollowMode UserLocationLayer.followMode ( )

Returns the current follow mode.

Dart code snippet:

final followMode = _userLocationLayer!.followMode();
print("Follow mode: $followMode");

◆ headingModeActive()

bool UserLocationLayer.headingModeActive ( )

Returns true if heading-up mode is enabled. Same as followMode() == HEADING.

Dart code snippet:

bool headingModeActive = _userLocationLayer!.headingModeActive();
print("Heading-up mode active: $headingModeActive");

◆ isValid()

bool UserLocationLayer.isValid ( )

◆ isVisible()

bool UserLocationLayer.isVisible ( )

Returns true if user location layer is visible.

Dart code snippet:

bool visible = _userLocationLayer!.isVisible();
print("User location layer is visible: $visible");

◆ resetAnchor()

void UserLocationLayer.resetAnchor ( )

Resets anchor to default (center).

Dart code snippet:

_userLocationLayer!.resetAnchor();
print("Anchor reset to default");

◆ setAccuracyColor()

void UserLocationLayer.setAccuracyColor ( Color color)

Sets the accuracy-circle fill. Default is a translucent blue.

Dart code snippet:

_userLocationLayer!.setAccuracyColor(const Color(0x4230AAD9));
print("Accuracy circle color updated");

◆ setAnchor()

void UserLocationLayer.setAnchor ( math.Point< double > anchor)

Sets anchor point for user indicator in screen pixels.

Dart code snippet:

ScreenPoint anchor = ScreenPoint(100.0, 200.0);
_userLocationLayer!.setAnchor(anchor);
print("Set user location anchor to: (${anchor.x}, ${anchor.y})");

◆ setArrowBitmap()

void UserLocationLayer.setArrowBitmap ( ImageProvider? bitmap)

Replaces the heading arrow bitmap. Null restores the built-in heading fan.

Dart code snippet:

_userLocationLayer!.setArrowBitmap(ImageProvider.fromImageProvider(
const AssetImage('assets/arrow.png'),
cacheable: true,
));
_userLocationLayer!.setArrowBitmap(null);
print("Custom arrow bitmap cleared");

◆ setFollowMode()

void UserLocationLayer.setFollowMode ( UserLocationFollowMode mode)

Sets how the camera follows the user. NONE stops following and keeps a previously set anchor point. POSITION, HEADING and COURSE follow even without setAnchor (screen center). setAnchor() from NONE switches to POSITION. resetAnchor() switches to NONE. setHeadingModeActive(true) switches to HEADING.

Dart code snippet:

_userLocationLayer!.setFollowMode(UserLocationFollowMode.HEADING);
print("Follow mode set to heading");

◆ setHeadingModeActive()

void UserLocationLayer.setHeadingModeActive ( bool active)

Enables or disables heading-up mode while the user location layer is anchored.

When enabled and a location heading is available, the map camera rotates to keep the user's heading pointed toward the top of the screen. Without an anchor the location icon keeps rotating independently.

Dart code snippet:

_userLocationLayer!.setHeadingModeActive(true);
print("Heading-up mode enabled");

◆ setVisible()

void UserLocationLayer.setVisible ( bool visible)

Shows or hides user location layer.

Dart code snippet:

_userLocationLayer!.setVisible(true);
print("User location layer set visible");

The documentation for this class was generated from the following file: