Marker Text #411
Marker Text
#411
-
|
Hey all, wondering if there's a way to have custom textFields per marker? Or do I need to implement something custom? Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
josxha
Nov 22, 2025
Replies: 1 comment 2 replies
-
|
Yes, that's possible by utilizing the feature properties. final _points = <Feature<Point>>[
const Feature(
geometry: Point(Geographic(lon: 9.17, lat: 47.68)),
properties: {'name': 'Marker 1'},
),
const Feature(
geometry: Point(Geographic(lon: 9.17, lat: 48)),
properties: {'name': 'Marker 2'},
),
];You can then use the name value by using this: MarkerLayer(
points: _points,
textField: '{name}', // <- reads name property
textAllowOverlap: true,
iconImage: _imageLoaded ? 'marker' : null,
iconSize: 0.15,
iconAnchor: IconAnchor.bottom,
textOffset: const [0, 1],
), |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
josxha
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, that's possible by utilizing the feature properties.
You can then use the name value by using this: