Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TileLayer
Reimplementation (& v4 Release Preparation) (#1475)
* Remove broken updateInterval option In passing I have also reduced the amount of calls to _setView() during build. * Remove Level since it had become a wrapper for CustomPoint It was also storing zoom but the same zoom value was used to look up the Level in TransformationCalculator. * Tile layer cleanup and simplification Simplified tile layer calculations. Tile layer is still very much a WIP. * TileRange and TileBounds abstractions implemented Still working on adding tests. * Working with all example app CRSes * Remove unnecessary _tileZoom and clean up some variables * Make TileImage a ChangeNotifier This avoids the need for TileLayer to rebuild the whole layer with setState when a tile finishes loading. In fact TileLayer no longer calls setState at all. * Rename TileManager to TileImageManager Also made a minor tidy-up in TileLayer build(). * Add TileUpdateTransformer to tile layer options This allows debouncing/filtering/modifying tile updates triggered by map movement. * Avoid notifying listeners once a tile has been disposed * Remove note about maybe needing to enable super mixins Super mixins are enabled by default since flutter 2.1 which is below flutter_map's package minimum requirement. See this comment and thread for why this note was there and why it can be removed. flutter/flutter#14317 (comment) * Remove TileCoordinate export. I don't see why it would be needed outside of this project. * Revert changes which were no longer needed * Ignore Podfile in example since it gets generated when running the app * Add tile scale calculations to the cache * Create missing TileImages during build See the code comments, this avoids a scenario where tiles are missing because a given map movement triggers a TileLayer rebuild before the tile loading is triggered. I added a lot of comments in passing. * Remove TilesContainer option since wrapping the TileLayer with the desired widget has the same behaviour * Remove TilesContainer option since wrapping the TileLayer with the desired widget has the same behaviour * Export TileCoordinate * Rename TileCoordinate to TileCoordinates * Add tileOpacity option * Add an example TileUpdateTransformer * Updated CHANGELOG and versioning throughout Renamed `tileOpacity` to `opacity` Removed deprecated features * Avoid reloading images when opacity changes * Combine opacity/fastReplace/tileFadeIn with a single tileDisplay option * Privatized `TileDisplay` extender's constructors Minor documentation fixes * Unified `TileDisplay`'s `.map` and `.when` methods * Simplified `TileProvider._getTileUrl` method * Make default TileUpdateTransformer ignore taps Given that we now default to using the TileUpdateTransformer removed listening to the move stream directly and we now always listen to the move stream mapped to TileLayerUpdate. This cleans up the TileLayer a bit and simplified implementation/combination for TileUpdateTransformers. * Add a throttling tile update transformer * Remove overrideTilesWhenUrlChanges option Now we will always hold on to old tiles until the new tiles have loaded to prevent flickering. * Updated CHANGELOG Updated GitHub Workflow * Applied formatting to 'gestures.dart' * Updated version Updated LICENSE to better represent copyright claims Removed 'CONTRIBUTING.md' * Updated CHANGELOG to include #1487 * Updated CHANGELOG to include #1495 * Fixed Android build warning in example app * Updated GitHub configuration * Added example app building to workflow Improvements to the example app and runner * Merged workflow files to enable building of example application * Attempted fix workflow issues * Changed incorrect path in workflow * Fix tile provider import It was always using the web tile provider. Now it correctly uses the io tile provider when not on web. * Remove unnecessary load/prune * Formatting * Avoid concurrent modification error when reloading tiles * Include UrlLauncherPlugin registration * Prevent map buttons from rotating * Remove unnecessary argument * Tidy up MapEvents - Remove MapEventSource.initialized since it is no longer used. - Make MapEvents const classes. - Use super parameters syntax. * Add MapEventNonRotatedSizeChange This new event is triggered when the map's non-rotated size is changed, it is not called when the map is initialized. This will fix TileLayer not loading new tiles when the map size changes. In passing I made some other improvements: - Expose nonRotatedSize’s full type (CustomPoint<double>? instead of CustomPoint?) to avoid unnecessary type casts. - Improve the check for the constraints being ready before setting initial zoom/center based on MapOptions bounds. - Remove unnecessary setState in FlutterMapState’s emitMapEvent. The event emitting does not change the map's state and was causing double calls to setState in some code paths. - FlutterMapState tidy ups. - Removed the workaround for the initial map size being zero in TileLayer which caused tiles to not be loaded. The new MapEventNonRotatedSizeChange event removes the need for this workaround as during startup either: - The platform has already set flutter's resolution and thus all tiles are successfully loaded. - The platform has not set flutter's resolution but when it does it will cause LayoutBuilder to rebuild with the new size which will trigger a MapEventNonRotatedSizeChange event. This event will in turn trigger a tile load in TileLayer. --------- Co-authored-by: JaffaKetchup <github@jaffaketchup.dev>
- Loading branch information