Skip to content

[BUG] Tiles sometimes do not load until extra event #1813

@coogle

Description

@coogle

What is the bug?

I'm not sure what exactly to report as the bug, but I have a situation where I am using an animation to move my map programmatically using the following code. The animation works pretty well, but at the end of the animation I end up with a totally gray map until I interact with it again (e.g. slightly zoom out or move the map by dragging).

All of the other layers render except the tile layer. I'm not seeing any network traffic downloading the tiles, but that said when the map does render after manual intervention it loads instantly (so it already had the tiles).

    void _smoothMoveMapTo(Location destination, double destZoom)
    {
        final latTween = Tween<double>(
            begin: context.read<MapBloc>().mapController.center.latitude,
            end: destination.latitude
        );

        final lonTween = Tween<double>(
            begin: context.read<MapBloc>().mapController.center.longitude,
            end: destination.longitude
        );

        final zoomTween = Tween<double>(
            begin: context.read<MapBloc>().mapController.camera.zoom,
            end: destZoom
        );

        final animation = CurvedAnimation(
            parent: _animationCtl,
            curve: Curves.fastOutSlowIn
        );

        _animationCtl.addListener(() => context.read<MapBloc>()
            .mapController.move(
                Location(latTween.evaluate(animation), lonTween.evaluate(animation)),
                zoomTween.evaluate(animation)
            )
        );

        _animationCtl.forward(from: 0);
    }

How can we reproduce it?

See provided animation controller which moves a map.

Do you have a potential solution?

As a workaround, or perhaps to fix a bug in my code because I missed something, I'm trying to figure out how to trigger whatever is happening when I manually interact with the map after moving to my destination to actually redraw it. Notably, I've tried ending the animation with one last move ... including on a slight delay .. to no effect.

Platforms

Flutter Web

Severity

Minimum: Allows normal functioning

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions