diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml index 5f62b2db9..87454f1d1 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report.yaml @@ -36,6 +36,11 @@ body: If you do not include any information here, it will take longer for us to verify your issue. placeholder: Text automatically formatted as Dart code, on submission render: dart + - type: textarea + id: solution + attributes: + label: Do you have a potential solution? + description: "If so, please detail it: it will make it quicker for us to fix the issue" - type: textarea id: additional-info attributes: @@ -101,7 +106,7 @@ body: required: true - label: I am using the [latest stable version](https://pub.dev/packages/flutter_map) of this package required: true - - label: I have checked the [Common Issues](https://docs.fleaflet.dev/usage/common-issues) documentation page + - label: I have checked the FAQs section on the documentation website required: true - label: I have checked for similar issues which may be duplicates required: true diff --git a/CHANGELOG.md b/CHANGELOG.md index c4b686d5d..6c438bc3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,31 @@ # Changelog -## [2.0.0] - 2022/XX/XX +## [2.1.0] - 2022/XX/XX + +Contains the following additions/removals: + +- Added built in keep alive functionality - [#1312](https://github.com/fleaflet/flutter_map/pull/1312) +- Added disposal of `AnimationController` before it is reassigned - [#1303](https://github.com/fleaflet/flutter_map/pull/1303) +- Added better polar projection support and example - [#1295](https://github.com/fleaflet/flutter_map/pull/1295) +- Added stroke cap and stroke join options to `Polygon`s - [#1295](https://github.com/fleaflet/flutter_map/pull/1295) + +Contains the following bug fixes: + +- Removed a class of `LateInitializationError`s by reworking `MapController` lifecycle - [#1293](https://github.com/fleaflet/flutter_map/pull/1293) for [#1288](https://github.com/fleaflet/flutter_map/issues/1288) +- Improved performance during painting `Polygon`s - [#1295](https://github.com/fleaflet/flutter_map/pull/1295) + +In other news: + +- None + +Many thanks to these contributors (in no particular order): + +- @Zverik +- @rbellens +- @JosefWN +- ... and all the maintainers + +## [2.0.0] - 2022/07/11 Contains the following additions/removals: diff --git a/lib/flutter_map.dart b/lib/flutter_map.dart index 7b198a5b3..f96424fc2 100644 --- a/lib/flutter_map.dart +++ b/lib/flutter_map.dart @@ -291,6 +291,14 @@ class MapOptions { /// would represent the full extent of the map, so no gray area outside of it. final LatLngBounds? maxBounds; + /// Flag to enable the built in keep alive functionality + /// + /// If the map is within a complex layout, such as a [ListView] or [PageView], + /// the map will reset to it's inital position after it appears back into view. + /// To ensure this doesn't happen, enable this flag to prevent the [FlutterMap] + /// widget from rebuilding. + final bool keepAlive; + _SafeArea? _safeAreaCache; double? _safeAreaZoom; @@ -334,6 +342,7 @@ class MapOptions { this.swPanBoundary, this.nePanBoundary, this.maxBounds, + this.keepAlive = false, }) : center = center ?? LatLng(50.5, 30.51), assert(rotationThreshold >= 0.0), assert(pinchZoomThreshold >= 0.0), diff --git a/lib/src/layer/tile_layer/tile_provider/network_no_retry_image_provider.dart b/lib/src/layer/tile_layer/tile_provider/network_no_retry_image_provider.dart index 059add3bf..44d6e05a1 100644 --- a/lib/src/layer/tile_layer/tile_provider/network_no_retry_image_provider.dart +++ b/lib/src/layer/tile_layer/tile_provider/network_no_retry_image_provider.dart @@ -90,11 +90,13 @@ class FMNetworkNoRetryImageProvider return decode(bytes); } catch (e) { scheduleMicrotask(() { - PaintingBinding.instance.imageCache.evict(key); + _ambiguate(PaintingBinding.instance.imageCache)?.evict(key); }); rethrow; } finally { chunkEvents.close(); } } + + T? _ambiguate(T? value) => value; } diff --git a/lib/src/map/flutter_map_state.dart b/lib/src/map/flutter_map_state.dart index 0d63caab4..13f5bd123 100644 --- a/lib/src/map/flutter_map_state.dart +++ b/lib/src/map/flutter_map_state.dart @@ -9,7 +9,8 @@ import 'package:flutter_map/src/map/map.dart'; import 'package:flutter_map/src/map/map_state_widget.dart'; import 'package:positioned_tap_detector_2/positioned_tap_detector_2.dart'; -class FlutterMapState extends MapGestureMixin { +class FlutterMapState extends MapGestureMixin + with AutomaticKeepAliveClientMixin { final List> groups = >[]; final _positionedTapController = PositionedTapController(); @@ -73,6 +74,7 @@ class FlutterMapState extends MapGestureMixin { @override Widget build(BuildContext context) { _disposeStreamGroups(); + super.build(context); return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { final hasLateSize = mapState.hasLateSize(constraints); @@ -230,4 +232,7 @@ Can't find correct layer for $options. Perhaps when you create your FlutterMap y options: new MapOptions(plugins: [MyFlutterMapPlugin()])""")); } + + @override + bool get wantKeepAlive => options.keepAlive; } diff --git a/pubspec.yaml b/pubspec.yaml index 17d0cc92d..220dfd850 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_map description: A versatile mapping package for Flutter, based off leaflet.js, that's simple and easy to learn, yet completely customizable and configurable. -version: 2.0.0 +version: 2.1.0 repository: https://github.com/fleaflet/flutter_map documentation: https://docs.fleaflet.dev