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

v2.1.0 Release & Keep Alive Functionality #1312

Merged
merged 6 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
27 changes: 26 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
9 changes: 9 additions & 0 deletions lib/flutter_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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),
Expand Down
7 changes: 6 additions & 1 deletion lib/src/map/flutter_map_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<StreamGroup<void>> groups = <StreamGroup<void>>[];
final _positionedTapController = PositionedTapController();

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down