mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

★★★★ Please fix SymbolLayer ★★★★

Open zsx29 opened this issue 2 years ago • 9 comments

"TextField" does not exist. Please fix it quickly

zsx29 avatar Jan 05 '24 07:01 zsx29

Hi @zsx29, thank you for reporting this, we've taken this into our immediate working plan, meanwhile you can use:

mapboxMap.style.setStyleLayerProperty("layer-id", "text-field", "My text");

to set the value of this property after you have added layer with "layer-id" to the style.

evil159 avatar Jan 22 '24 15:01 evil159

I want to set my "text-field" is a number, but it can't show. Only show String. Please help

dhaq avatar Mar 05 '24 02:03 dhaq

@dhaq You can convert number to a string before passing it to the map.

evil159 avatar Apr 12 '24 10:04 evil159

This is happening to me also. It's only a problem on Android. iOS works fine.

This fails to set the text field: mapboxMap.style.setStyleLayerProperty("layer-id", "text-field", "210");

This works: mapboxMap.style.setStyleLayerProperty("layer-id", "text-field", "_210");

Anything where the string passed in is numerals only fails. Very odd.

When it fails I get this exception:

Exception has occurred.
PlatformException (PlatformException(java.lang.Throwable: Formatted must be plain string or array type., Throwable, Cause: null, Stacktrace: java.lang.Throwable: Formatted must be plain string or array type.
	at com.mapbox.maps.mapbox_maps.StyleController.setStyleLayerProperty$lambda$18(StyleController.kt:213)
	at com.mapbox.maps.mapbox_maps.StyleController.$r8$lambda$MpWjrmV9gatZ-HjWrSMdbJIAO9c(Unknown Source:0)
	at com.mapbox.maps.mapbox_maps.StyleController$$ExternalSyntheticLambda13.onStyleLoaded(Unknown Source:8)
	at com.mapbox.maps.MapboxMap.getStyle(MapboxMap.kt:359)
	at com.mapbox.maps.mapbox_maps.StyleController.setStyleLayerProperty(StyleController.kt:209)
	at com.mapbox.maps.pigeons.FLTMapInterfaces$StyleManager$-CC.lambda$setup$15(FLTMapInterfaces.java:8990)
	at com.mapbox.maps.pigeons.FLTMapInterfaces$StyleManager$$ExternalSyntheticLambda39.onMessage(Unknown Source:2)
	at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:261)
	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
	at android.os.Handler.handleCallback(Handler.java:958)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:205)
	at android.os.Looper.loop(Looper.java:294)
	at android.app.ActivityThread.main(ActivityThread.java:8177)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
, null))

timeuser avatar Apr 15 '24 16:04 timeuser

Hi @zsx29, thank you for reporting this, we've taken this into our immediate working plan, meanwhile you can use:

mapboxMap.style.setStyleLayerProperty("layer-id", "text-field", "My text");

to set the value of this property after you have added layer with "layer-id" to the style.

This only works if all your markers in the layer have the same text right? When are we likely to see expressions made available here so that we can add meaningful labels?

noforeignland avatar Apr 16 '24 20:04 noforeignland

Hi all, could you please provide which MapboxMaps Flutter plugin version you are using?

maios avatar May 02 '24 09:05 maios

Hi all, could you please provide which MapboxMaps Flutter plugin version you are using?

Issue still present on latest version (1.1.0)

Pavlo-Freebee avatar May 02 '24 18:05 Pavlo-Freebee

Hi @zsx29, thank you for reporting this, we've taken this into our immediate working plan, meanwhile you can use:

mapboxMap.style.setStyleLayerProperty("layer-id", "text-field", "My text");

to set the value of this property after you have added layer with "layer-id" to the style.

Good temporary workaround! Just wanted to add that if you're setting the text through a Feature property (i.e. properties: {'title': 'text goes here'}) then we need to set the value the same way we do in the react library: mapboxMap.style.setStyleLayerProperty("layer-id", "text-field", ['get', 'title']);. @noforeignland

Pavlo-Freebee avatar May 02 '24 18:05 Pavlo-Freebee

Should this ticked be closed now? It looks like text can be added in 2.0.x. Thanks.

noforeignland avatar Aug 18 '24 10:08 noforeignland