Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: repair TileLayer.tileBounds #1713

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

josxha
Copy link
Contributor

@josxha josxha commented Nov 1, 2023

This pull request fixes the TileLayer.tileBounds property (issue #1710).
It was such a small bug that I overlooked it multiple times. 🥲

Additionally it fixes a typo and removes a duplicate variable.

See a minimal example here
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
        home: TileBoundsTest(),
    );
  }
}

class TileBoundsTest extends StatelessWidget {
  const TileBoundsTest({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Tile bounds test')),
      body: Padding(
        padding: const EdgeInsets.all(8),
        child: Column(
          children: [
            Flexible(
              child: FlutterMap(
                options: const MapOptions(
                  initialCenter: LatLng(53.189206, -1.821145),
                  initialZoom: 5,
                ),
                children: [
                  TileLayer(
                    urlTemplate:
                    'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
                    userAgentPackageName: 'dev.fleaflet.flutter_map.example',
                    tileBounds: LatLngBounds(
                      const LatLng(58.429514, -13.084017),
                      const LatLng(50.221127, 1.802305),
                    ), // uk bounds
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}

@josxha josxha self-assigned this Nov 1, 2023
Copy link
Member

@JaffaKetchup JaffaKetchup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! My mistake on the docs spelling - can never spell "recieve" correctly :D

@JaffaKetchup JaffaKetchup linked an issue Nov 1, 2023 that may be closed by this pull request
@JaffaKetchup JaffaKetchup changed the title Fix TileLayer.tileBounds not working fix: repair TileLayer.tileBounds Nov 1, 2023
@JaffaKetchup JaffaKetchup merged commit 1964910 into fleaflet:master Nov 1, 2023
josxha added a commit that referenced this pull request Nov 28, 2023
@josxha josxha added this to the v6.1 milestone Dec 2, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] TileLayer.tileBounds not working
2 participants