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

[FEATURE] loadingTileDisplay for TileLayer #1980

Closed
edeetee opened this issue Oct 19, 2024 · 1 comment
Closed

[FEATURE] loadingTileDisplay for TileLayer #1980

edeetee opened this issue Oct 19, 2024 · 1 comment
Labels
feature This issue requests a new feature

Comments

@edeetee
Copy link

edeetee commented Oct 19, 2024

What do you want implemented?

Fallback to show a custom tile while tile is loading.

For my use case, I have a tile server serving transparent tiles. The tiles are mostly content:
Screenshot 2024-10-19 at 6 11 42 PM

When I load new tiles, the map doesn't render anything where it hasn't yet loaded:
Screenshot 2024-10-19 at 6 12 33 PM

It would be ideal if I had some way to provide a custom tile that can render content in the loading area. I would render with the transparent red I am using elsewhere.

For context, here is my layer code, containing an Opacity widget:

class NavigationAvailabilityOverlay extends ConsumerWidget {
  const NavigationAvailabilityOverlay({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return Opacity(
      opacity: 0.5,
      child: TileLayer(
        tileProvider: CancellableNetworkTileProvider(),
        tileUpdateTransformer: TileUpdateTransformers.throttle(
          const Duration(milliseconds: 500),
        ),
        urlTemplate:
            "$devOrigin/routing/availability_tile.png?z={z}&y={y}&x={x}",
        tileDisplay: const TileDisplay.instantaneous(),
        maxNativeZoom: 22,
      ),
    );
  }
}

What other alternatives are available?

I could add a background layer but this wouldn't work with the transparent tiles.

Can you provide any other information?

I could be interested in implementing a pr if someone can give me some guidance to where I should start in the TileLayer code.

Severity

Annoying: Currently have to use workarounds

@edeetee edeetee added the feature This issue requests a new feature label Oct 19, 2024
@josxha
Copy link
Contributor

josxha commented Oct 19, 2024

Hi @edeetee, this functionality is already possible using the tileBuilder.
Return your loading widget when tile.loadFinishedAt is null.

@josxha josxha closed this as completed Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue requests a new feature
Projects
Status: Done
Development

No branches or pull requests

2 participants