Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
josxha authored Dec 8, 2023
2 parents aff2dfc + 135180b commit 84849ac
Show file tree
Hide file tree
Showing 24 changed files with 900 additions and 528 deletions.
44 changes: 42 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,50 @@
# Changelog

## [6.0.1] - 2023/10/XX
Please consider [donating](https://docs.fleaflet.dev/supporters#support-us) or [contributing](https://docs.fleaflet.dev/credits#contributing) if you're a fan of what we're doing and you'd like to support future releases!

## [6.1.0] - 2023/12/02

Contains the following user-affecting changes:

- 🟢 Added option to draw labels on top of all `Polygon`s in a layer - [#1707](https://github.com/fleaflet/flutter_map/pull/1707)
- (Released 'flutter_map_cancellable_tile_provider' [v2.0.0](https://pub.dev/packages/flutter_map_cancellable_tile_provider/changelog))

Contains the following user-affecting bug fixes:

- Removed flutter_map text attribution when `RichAttributionWidget.showFlutterMapAttribution` is `false` - [#1712](https://github.com/fleaflet/flutter_map/pull/1712)
- Repaired `TileLayer.tileBounds` - [#1713](https://github.com/fleaflet/flutter_map/pull/1713) for [#1710](https://github.com/fleaflet/flutter_map/issues/1710)
- Added `doubleTapDragZoom` and `scrollWheelZoom` to `InteractiveFlag.all` - [#1726](https://github.com/fleaflet/flutter_map/pull/1726) for [#1725](https://github.com/fleaflet/flutter_map/issues/1725)
- Repaired correct movement for `CircleLayer` when panning - [#1735](https://github.com/fleaflet/flutter_map/pull/1735)
- Improved value distribution for `MapPosition.hashCode` - [#1747](https://github.com/fleaflet/flutter_map/pull/1747)

Contains the following user-affecting performance improvements:

- Optimized `Bounds` - [#1706](https://github.com/fleaflet/flutter_map/pull/1706)
- Avoided creating a new list on every frame unnecessarily - [#1708](https://github.com/fleaflet/flutter_map/pull/1708)
- Cull `Polygon` labels seperately (more strongly), and cache the `TextPainter` - [#1716](https://github.com/fleaflet/flutter_map/pull/1716)
- Avoided caching a single commonly-used multiplication - [#1743](https://github.com/fleaflet/flutter_map/pull/1743)

Many thanks to these contributors (in no particular order):

- @ignatz
- @amal-stack
- @Robbendebiene
- ... and all the maintainers

And an additional special thanks to @ignatz for investing so much of their time into this project recently - we appreciate it!

In other news:

- A warm welcome to @josxha, who's recently joined the maintainer team
- We've also made some widespread minor improvmenents to the example application
- Check out the new [Showcase](https://docs.fleaflet.dev/showcase) page on our docs for some awesome projects
- We're working on some very exciting reworked features and performance improvements for v7 - keep an ear out by joining our [Discord server](https://discord.gg/BwpEsjqMAH)

## [6.0.1] - 2023/10/24

Contains the following user-affecting bug fixes:

- Fixed `CircleMarker`'s incorrect appearance and size - [#1692](https://github.com/fleaflet/flutter_map/pull/1692) for [#1688](https://github.com/fleaflet/flutter_map/issues/1688)
- Fixed `CircleMarker`'s incorrect appearance and size - [#1692](https://github.com/fleaflet/flutter_map/pull/1692) for [#1688](https://github.com/fleaflet/flutter_map/issues/1688)
- Fixed `LateInitializationError` when specifying `initialCameraFit` - [#1691](https://github.com/fleaflet/flutter_map/pull/1691) for [#1684](https://github.com/fleaflet/flutter_map/issues/1684)
- Fixed incorrect behaviour issues caused by the adjusted default `MapOptions.cameraConstraint` - [#1700](https://github.com/fleaflet/flutter_map/pull/1700) for [#1682](https://github.com/fleaflet/flutter_map/issues/1682) & [#1699](https://github.com/fleaflet/flutter_map/issues/1699)
- Fixed bug where not providing either `wmsOptions` nor `urlTemplate` caused a null exception in `getTileUrl` and when `retinaMode` is `true` - [#1701](https://github.com/fleaflet/flutter_map/pull/1701)
Expand Down
15 changes: 8 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Contributing

'flutter_map' is only as great as it is because of generous open-source contributors!

We're always happy to receive improvements and fixes, so please submit them whenever you can! A few key points are listed below.

> Many feature additions are more suitable for plugins, instead of being added to the core. This is aimed to reduce the future maintenance burden/cost on the maintainers.
If we deny your PR for this reason, please do consider publishing a plugin, and we'll be happy to add it to the [Plugins List](https://docs.fleaflet.dev/plugins/list)! See [Making A Plugin](https://docs.fleaflet.dev/plugins/making-a-plugin) for more information.

* If your PR will add a major or breaking change, please discuss it with us first, via the Issue Tracker
* Always link your PR to at least one issue, and as many as are resolved
* Create a draft PR as soon as work starts, and take it out of draft status when ready for review
* Avoid changing the package version or GitHub workflows
* Fix issues reported by the GitHub workflows (such as formatting) yourself
* **If your PR will add a major or breaking change, please discuss it with us first, via the Issue Tracker**
We don't want to waste your time if we think it's more appropriate for a plugin, and it helps to make a clear plan before starting work
* **Create a draft PR as soon as work starts, and take it out of draft status when ready for review**
Keep everyone in the loop, so no-one tries working on the same thing as you
* **Don't change the package version, GitHub workflows, lints, or any other meta files without clarification**
We rely on a standardized process and procedure to ensure top-quality releases
* **Use a clear (preferably [Conventional](https://www.conventionalcommits.org/)) PR title**
This makes it easier for us to group commits for release and write correct CHANGELOGs
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ linter:
noop_primitive_operations: true
avoid_void_async: true
avoid_redundant_argument_values: true
avoid_types_on_closure_parameters: true
unnecessary_null_checks: true
prefer_single_quotes: true
unnecessary_parenthesis: true
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (flutterVersionCode == null) {

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '6.0.1'
flutterVersionName = '6.1.0'
}

android {
Expand Down
28 changes: 13 additions & 15 deletions example/lib/pages/plugin_scalebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,20 @@ class PluginScaleBar extends StatelessWidget {
return Scaffold(
appBar: AppBar(title: const Text('Scale Bar Plugin')),
drawer: const MenuDrawer(PluginScaleBar.route),
body: Flexible(
child: FlutterMap(
options: const MapOptions(
initialCenter: LatLng(51.5, -0.09),
initialZoom: 5,
),
children: [
openStreetMapTileLayer,
const FlutterMapScaleLayer(
lineColor: Colors.black,
lineWidth: 3,
textStyle: TextStyle(color: Colors.black, fontSize: 14),
padding: EdgeInsets.all(10),
),
],
body: FlutterMap(
options: const MapOptions(
initialCenter: LatLng(51.5, -0.09),
initialZoom: 5,
),
children: [
openStreetMapTileLayer,
const FlutterMapScaleLayer(
lineColor: Colors.black,
lineWidth: 3,
textStyle: TextStyle(color: Colors.black, fontSize: 14),
padding: EdgeInsets.all(10),
),
],
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_map_example
description: Example application for 'flutter_map' package
publish_to: "none"
version: 6.0.1
version: 6.1.0

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion lib/flutter_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export 'package:flutter_map/src/layer/tile_layer/tile_update_transformer.dart';
export 'package:flutter_map/src/map/camera/camera.dart';
export 'package:flutter_map/src/map/camera/camera_constraint.dart';
export 'package:flutter_map/src/map/camera/camera_fit.dart';
export 'package:flutter_map/src/map/controller/impl.dart';
export 'package:flutter_map/src/map/controller/map_controller.dart';
export 'package:flutter_map/src/map/controller/map_controller_impl.dart';
export 'package:flutter_map/src/map/options/cursor_keyboard_rotation.dart';
export 'package:flutter_map/src/map/options/interaction.dart';
export 'package:flutter_map/src/map/options/options.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/geo/latlng_bounds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class LatLngBounds {
final lambda3 = lambda1 + math.atan2(by, math.cos(phi1) + bx);

// phi3 and lambda3 are actually in radians and LatLng wants degrees
return LatLng(radianToDeg(phi3), radianToDeg(lambda3));
return LatLng(phi3 * radians2Degrees, lambda3 * radians2Degrees);
}

/// Checks whether [point] is inside bounds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,7 @@ import 'dart:math' as math;
import 'package:flutter/gestures.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_map/src/gestures/interactive_flag.dart';
import 'package:flutter_map/src/gestures/latlng_tween.dart';
import 'package:flutter_map/src/gestures/map_events.dart';
import 'package:flutter_map/src/gestures/multi_finger_gesture.dart';
import 'package:flutter_map/src/gestures/positioned_tap_detector_2.dart';
import 'package:flutter_map/src/map/camera/camera.dart';
import 'package:flutter_map/src/map/controller/internal.dart';
import 'package:flutter_map/src/map/options/cursor_keyboard_rotation.dart';
import 'package:flutter_map/src/map/options/interaction.dart';
import 'package:flutter_map/src/map/options/options.dart';
import 'package:flutter_map/src/misc/point_extensions.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
import 'package:vector_math/vector_math_64.dart';

Expand All @@ -26,23 +16,22 @@ typedef InteractiveViewerBuilder = Widget Function(

/// Applies interactions (gestures/scroll/taps etc) to the current [MapCamera]
/// via the internal [controller].
class FlutterMapInteractiveViewer extends StatefulWidget {
class MapInteractiveViewer extends StatefulWidget {
final InteractiveViewerBuilder builder;
final FlutterMapInternalController controller;
final MapControllerImpl controller;

const FlutterMapInteractiveViewer({
const MapInteractiveViewer({
super.key,
required this.builder,
required this.controller,
});

@override
State<FlutterMapInteractiveViewer> createState() =>
FlutterMapInteractiveViewerState();
State<MapInteractiveViewer> createState() => MapInteractiveViewerState();
}

class FlutterMapInteractiveViewerState
extends State<FlutterMapInteractiveViewer> with TickerProviderStateMixin {
class MapInteractiveViewerState extends State<MapInteractiveViewer>
with TickerProviderStateMixin {
static const int _kMinFlingVelocity = 800;
static const _kDoubleTapZoomDuration = 200;
static const doubleTapDelay = Duration(milliseconds: 250);
Expand Down Expand Up @@ -336,11 +325,10 @@ class FlutterMapInteractiveViewerState
if (_interactionOptions.cursorKeyboardRotationOptions.setNorthOnClick &&
_ckrTriggered.value &&
_ckrInitialDegrees == _camera.rotation) {
widget.controller.rotate(
widget.controller.rotateRaw(
getCursorRotationDegrees(event.localPosition),
hasGesture: true,
source: MapEventSource.cursorKeyboardRotation,
id: null,
);
}

Expand Down Expand Up @@ -372,14 +360,13 @@ class FlutterMapInteractiveViewerState
final baseSetNorth =
getCursorRotationDegrees(event.localPosition) - _ckrClickDegrees;

widget.controller.rotate(
widget.controller.rotateRaw(
_interactionOptions.cursorKeyboardRotationOptions.behaviour ==
CursorRotationBehaviour.setNorth
? baseSetNorth
: (_ckrInitialDegrees + baseSetNorth) % 360,
hasGesture: true,
source: MapEventSource.cursorKeyboardRotation,
id: null,
);

if (_interactionOptions.cursorKeyboardRotationOptions.behaviour ==
Expand Down Expand Up @@ -408,13 +395,11 @@ class FlutterMapInteractiveViewerState
pointerSignal.localPosition.toPoint(),
newZoom,
);
widget.controller.move(
widget.controller.moveRaw(
newCenter,
newZoom,
offset: Offset.zero,
hasGesture: true,
source: MapEventSource.scrollWheel,
id: null,
);
},
);
Expand Down Expand Up @@ -501,7 +486,7 @@ class FlutterMapInteractiveViewerState
return;
}

final currentRotation = radianToDeg(details.rotation);
final currentRotation = details.rotation * radians2Degrees;
if (_dragMode) {
_handleScaleDragUpdate(details);
} else if (InteractiveFlag.hasMultiFinger(_interactionOptions.flags)) {
Expand Down Expand Up @@ -619,13 +604,11 @@ class FlutterMapInteractiveViewerState
}

if (_pinchZoomStarted || _pinchMoveStarted) {
widget.controller.move(
widget.controller.moveRaw(
newCenter,
newZoom,
offset: Offset.zero,
hasGesture: true,
source: MapEventSource.onMultiFinger,
id: null,
);
}
}
Expand Down Expand Up @@ -664,14 +647,13 @@ class FlutterMapInteractiveViewerState
final rotatedVector = vector.rotate(degrees2Radians * rotationDiff);
final newCenter = rotationCenter + rotatedVector;

widget.controller.moveAndRotate(
widget.controller.moveAndRotateRaw(
_camera.unproject(newCenter),
_camera.zoom,
_camera.rotation + rotationDiff,
offset: Offset.zero,
hasGesture: true,
source: MapEventSource.onMultiFinger,
id: null,
);
}
}
Expand Down Expand Up @@ -844,13 +826,11 @@ class FlutterMapInteractiveViewerState
}

void _handleDoubleTapZoomAnimation() {
widget.controller.move(
widget.controller.moveRaw(
_doubleTapCenterAnimation.value,
_doubleTapZoomAnimation.value,
offset: Offset.zero,
hasGesture: true,
source: MapEventSource.doubleTapZoomAnimationController,
id: null,
);
}

Expand All @@ -874,13 +854,11 @@ class FlutterMapInteractiveViewerState
final max = _options.maxZoom ?? double.infinity;
final actualZoom = math.max(min, math.min(max, newZoom));

widget.controller.move(
widget.controller.moveRaw(
_camera.center,
actualZoom,
offset: Offset.zero,
hasGesture: true,
source: MapEventSource.doubleTapHold,
id: null,
);
}
}
Expand All @@ -896,13 +874,11 @@ class FlutterMapInteractiveViewerState
_flingAnimation.value.toPoint().rotate(_camera.rotationRad);
final newCenter = _camera.unproject(newCenterPoint);

widget.controller.move(
widget.controller.moveRaw(
newCenter,
_camera.zoom,
offset: Offset.zero,
hasGesture: true,
source: MapEventSource.flingAnimationController,
id: null,
);
}

Expand Down
1 change: 0 additions & 1 deletion lib/src/layer/marker_layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class MarkerLayer extends StatelessWidget {

return MobileLayerTransformer(
child: Stack(
// ignore: avoid_types_on_closure_parameters
children: (List<Marker> markers) sync* {
for (final m in markers) {
// Resolve real alignment
Expand Down
1 change: 0 additions & 1 deletion lib/src/layer/tile_layer/tile_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ class TileImage extends ChangeNotifier {

if (evictImageFromCache) {
try {
// ignore: avoid_types_on_closure_parameters
imageProvider.evict().catchError((Object e) {
debugPrint(e.toString());
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ abstract class TileProvider {
}

/// Called when the [TileLayer] is disposed
///
/// When disposing resources, ensure that they are not currently being used
/// by tiles in progress.
void dispose() {}

/// Regex that describes the format of placeholders in a `urlTemplate`
Expand Down
Loading

0 comments on commit 84849ac

Please sign in to comment.