Upgrading past 1.1.0 causes styles source data to flicker
I'm having an issue with my mapbox style after upgrading the SDK to any version past 1.1.0. Layers in my styles.json start to disappear and reappear randomly at various zoom levels after a short time of using the map. It's almost like whole tiles just pop in and out. As soon as I move up to 2.0.0 and beyond, this issue happens (testing on iOS, not sure if this happens on Android too).
I should also mention that I’m using a tile server to serve my tiles, and this behavior doesn’t occur when I test on the web.
Here is my flutter widget as well as the linked styles.json file thats being used.
Widget build(BuildContext context) {
return Stack(
children: [
SizedBox(
height: widget.contentHeight,
child: Stack(
children: [
_buildNativeMap(),
if (_isMapInitialized) _buildFloatingButtons(),
],
),
),
]
);
}
Widget _buildNativeMap() {
return MapWidget(
key: const ValueKey("mapWidget"),
cameraOptions: CameraOptions(
center: Point(coordinates: Position(0, 0)).toJson(),
zoom: _currentZoom,
),
styleUri: 'https://glideai-mapbox-tiles.s3.us-east-2.amazonaws.com/styles/glideAI_style.json',
onMapCreated: _onMapCreated,
onTapListener: _onTapListener,
);
}
void _onMapCreated(MapboxMap mapboxMap) async {
this.mapboxMap = mapboxMap;
pointAnnotationManager = await mapboxMap.annotations.createPointAnnotationManager();
// Automatically navigate to location when the map is loaded
Future.delayed(const Duration(seconds: 1), () {
mapboxMap.easeTo(
CameraOptions(
center: Point(coordinates: Position(widget.longitude, widget.latitude)).toJson(),
zoom: 9,
),
MapAnimationOptions(duration: 1000),
);
});
_setupCameraListener();
_setupLocationComponent();
_setupGestureSettings();
_updateOrnamentSettings();
if (widget.isCreateAnnotation) {
_createLocationAnnotation(widget.latitude, widget.longitude);
}
setState(() {
_isMapInitialized = true;
});
}
Let me know if there is any more information that I can provide.
Hi @adambeer, thank you for the detailed report, I'm able to reproduce the issue with the style url you have provided. The issue appears to be another instance of https://github.com/mapbox/mapbox-maps-flutter/issues/800.
@evil159 Has there been any progress made on this or #800? There are lots of improvements we would like to take advantage of in later SDK's but are stuck on 1.1.0 until this issue is resolved.
Hi @adambeer, sorry for the delay and thank you for the patience, we have identified the root cause and aiming for a patch release next week.
Hi @adambeer, the issue should be addressed in 2.5.1 that has just been released.