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

Tiles are not shown if used in another instance of FlutterMap #636

Closed
guenth39 opened this issue May 28, 2020 · 6 comments · Fixed by #715
Closed

Tiles are not shown if used in another instance of FlutterMap #636

guenth39 opened this issue May 28, 2020 · 6 comments · Fixed by #715
Labels
bug This issue reports broken functionality or another error

Comments

@guenth39
Copy link

For details look at the screen record from current version of example app.
To reproduce just start the example app and switch between 'MapController' and 'AnimatedMapController'. Unfortunately it’s blocking the app in my use case of FlutterMap because I push multiple instances of FlutterMap with ineractive: false to the navigation stack and you can just remove the 'grayscreen' by zooming in or out. Would be awesome to have a solution for that.

video-2020-05-28-16-56-41

Best Regards

@guenth39 guenth39 changed the title Tiles are not shown if shown in another instance of FlutterMap Tiles are not shown if used in another instance of FlutterMap May 28, 2020
@guenth39
Copy link
Author

I think it has something to do with the CachingNetworkTileProvider because the issue does not appear on the ZoomButtonPlugins Page and there the NonCachingNetworkTileProvider is used.

@ibrierley
Copy link
Collaborator

You may be able to fake it by adding a move or slightly changing the zoom to something and back again, which will force a refresh ?

@guenth39
Copy link
Author

guenth39 commented May 28, 2020

Thanks for that hint. Thought about that earlier but didn't came back to it. Tried it now and works fine :) added the following code:

@override
  void didUpdateWidget(SimpleMapView oldWidget) {
    super.didUpdateWidget(oldWidget);
    if (widget.position != oldWidget.position || widget.zoom != oldWidget.zoom)
      _mapController?.move(widget.position, 18);
    Future.delayed(Duration(milliseconds: 200)).then(
      (value) => _mapController?.move(widget.position, widget.zoom),
    );
  }

EDIT:
As I found out it just works for coming back to the widget but not for coming first time to the widget, so for initState

@johnpryan johnpryan added the bug This issue reports broken functionality or another error label May 28, 2020
@ruizalexandre
Copy link

ruizalexandre commented May 29, 2020

With flutter_map version 8, tiles are correctly displayed.
Seems that a commit from version 9 break something.
Need to explore git history and find the issue

EDIT: Commit d4aefae breaks tiles display
I'm going to write a PR to fix that

@ruizalexandre
Copy link

@johnpryan PR available
Fix the race condition

@maRci002
Copy link
Contributor

maRci002 commented Aug 4, 2020

PR #715 is an easy applicable fix, try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports broken functionality or another error
Projects
None yet
5 participants