Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading past 1.1.0 causes styles source data to flicker #806

Open
adambeer opened this issue Dec 11, 2024 · 2 comments
Open

Upgrading past 1.1.0 causes styles source data to flicker #806

adambeer opened this issue Dec 11, 2024 · 2 comments

Comments

@adambeer
Copy link

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.

@adambeer adambeer changed the title Upgrading past 1.1.0 causes styles source data to render Upgrading past 1.1.0 causes styles source data to flicker Dec 12, 2024
@evil159
Copy link
Contributor

evil159 commented Dec 12, 2024

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 #800.

@adambeer
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants