Skip to content

Commit

Permalink
Merge branch 'master' into pr/1801
Browse files Browse the repository at this point in the history
  • Loading branch information
josxha committed Jan 19, 2024
2 parents 7a0d178 + 4a00390 commit 2bb0671
Show file tree
Hide file tree
Showing 49 changed files with 92 additions and 214 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ linter:
unnecessary_parenthesis: true
use_if_null_to_convert_nulls_to_bools: true
matching_super_parameters: true
prefer_const_constructors: true
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ android {
defaultConfig {
applicationId "dev.fleaflet.flutter_map.example"
minSdkVersion flutter.minSdkVersion
targetSdkVersion 31
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
3 changes: 3 additions & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx4G
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
2 changes: 1 addition & 1 deletion example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "com.android.application" version '8.2.0' apply false
}

include ":app"
5 changes: 1 addition & 4 deletions lib/flutter_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,4 @@ export 'package:flutter_map/src/map/options/interaction.dart';
export 'package:flutter_map/src/map/options/options.dart';
export 'package:flutter_map/src/map/widget.dart';
export 'package:flutter_map/src/misc/bounds.dart';
export 'package:flutter_map/src/misc/center_zoom.dart';
export 'package:flutter_map/src/misc/move_and_rotate_result.dart';
export 'package:flutter_map/src/misc/point_extensions.dart';
export 'package:flutter_map/src/misc/position.dart';
export 'package:flutter_map/src/misc/extensions.dart';
6 changes: 5 additions & 1 deletion lib/src/geo/crs.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:math' as math hide Point;
import 'dart:math' show Point;

import 'package:flutter_map/src/misc/bounds.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
import 'package:meta/meta.dart';
import 'package:proj4dart/proj4dart.dart' as proj4;
Expand Down Expand Up @@ -39,6 +39,7 @@ abstract class Crs {
/// Converts a point on the sphere surface (with a certain zoom) to a
/// scaled map point.
(double, double) latLngToXY(LatLng latlng, double scale);

Point<double> latLngToPoint(LatLng latlng, double zoom) {
final (x, y) = latLngToXY(latlng, scale(zoom));
return Point<double>(x, y);
Expand Down Expand Up @@ -355,6 +356,7 @@ abstract class Projection {
@nonVirtual
LatLng unproject(Point point) =>
unprojectXY(point.x.toDouble(), point.y.toDouble());

LatLng unprojectXY(double x, double y);
}

Expand Down Expand Up @@ -472,5 +474,7 @@ class _Transformation {
// Num.clamp is slow due to virtual function overhead.
double _clampSym(double value, double limit) =>
value < -limit ? -limit : (value > limit ? limit : value);

double _inclusiveLat(double value) => _clampSym(value, 90);

double _inclusiveLng(double value) => _clampSym(value, 180);
2 changes: 1 addition & 1 deletion lib/src/gestures/map_events.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter_map/src/map/camera/camera.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
import 'package:meta/meta.dart';

Expand Down
5 changes: 1 addition & 4 deletions lib/src/layer/attribution_layer/rich/widget.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_map/src/gestures/map_events.dart';
import 'package:flutter_map/src/layer/attribution_layer/rich/animation.dart';
import 'package:flutter_map/src/layer/attribution_layer/rich/source.dart';
import 'package:flutter_map/src/map/controller/map_controller.dart';
import 'package:flutter_map/flutter_map.dart';

/// Position to anchor [RichAttributionWidget] to relative to the [FlutterMap]
///
Expand Down
17 changes: 8 additions & 9 deletions lib/src/layer/circle_layer.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'dart:ui';

import 'package:flutter/widgets.dart';
import 'package:flutter_map/src/layer/general/mobile_layer_transformer.dart';
import 'package:flutter_map/src/map/camera/camera.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart' hide Path;

/// Immutable marker options for circle markers
Expand Down Expand Up @@ -49,9 +48,9 @@ class CircleLayer extends StatelessWidget {
@immutable
class CirclePainter extends CustomPainter {
final List<CircleMarker> circles;
final MapCamera map;
final MapCamera camera;

const CirclePainter(this.circles, this.map);
const CirclePainter(this.circles, this.camera);

@override
void paint(Canvas canvas, Size size) {
Expand All @@ -64,11 +63,11 @@ class CirclePainter extends CustomPainter {
final pointsFilledBorder = <Color, Map<double, List<Offset>>>{};
final pointsBorder = <Color, Map<double, Map<double, List<Offset>>>>{};
for (final circle in circles) {
final offset = map.getOffsetFromOrigin(circle.point);
final offset = camera.getOffsetFromOrigin(circle.point);
double radius = circle.radius;
if (circle.useRadiusInMeter) {
final r = distance.offset(circle.point, circle.radius, 180);
final delta = offset - map.getOffsetFromOrigin(r);
final delta = offset - camera.getOffsetFromOrigin(r);
radius = delta.distance;
}
points[circle.color] ??= {};
Expand All @@ -82,7 +81,7 @@ class CirclePainter extends CustomPainter {
double radiusBorder = circle.radius + circle.borderStrokeWidth;
if (circle.useRadiusInMeter) {
final rBorder = distance.offset(circle.point, radiusBorder, 180);
final deltaBorder = offset - map.getOffsetFromOrigin(rBorder);
final deltaBorder = offset - camera.getOffsetFromOrigin(rBorder);
radiusBorder = deltaBorder.distance;
}
pointsFilledBorder[circle.borderColor] ??= {};
Expand All @@ -92,7 +91,7 @@ class CirclePainter extends CustomPainter {
double realRadius = circle.radius;
if (circle.useRadiusInMeter) {
final rBorder = distance.offset(circle.point, realRadius, 180);
final deltaBorder = offset - map.getOffsetFromOrigin(rBorder);
final deltaBorder = offset - camera.getOffsetFromOrigin(rBorder);
realRadius = deltaBorder.distance;
}
pointsBorder[circle.borderColor] ??= {};
Expand Down Expand Up @@ -158,5 +157,5 @@ class CirclePainter extends CustomPainter {

@override
bool shouldRepaint(CirclePainter oldDelegate) =>
circles != oldDelegate.circles || map != oldDelegate.map;
circles != oldDelegate.circles || camera != oldDelegate.camera;
}
4 changes: 1 addition & 3 deletions lib/src/layer/marker_layer.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'dart:math';

import 'package:flutter/widgets.dart';
import 'package:flutter_map/src/layer/general/mobile_layer_transformer.dart';
import 'package:flutter_map/src/map/camera/camera.dart';
import 'package:flutter_map/src/misc/bounds.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';

/// A container for a [child] widget located at a geographic coordinate [point]
Expand Down
6 changes: 1 addition & 5 deletions lib/src/layer/overlay_image_layer.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_map/src/geo/latlng_bounds.dart';
import 'package:flutter_map/src/layer/general/mobile_layer_transformer.dart';
import 'package:flutter_map/src/map/camera/camera.dart';
import 'package:flutter_map/src/misc/bounds.dart';
import 'package:flutter_map/src/misc/point_extensions.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';

/// Base class for all overlay images.
Expand Down
7 changes: 1 addition & 6 deletions lib/src/layer/polygon_layer/polygon_layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import 'dart:ui' as ui;
import 'package:collection/collection.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_map/src/geo/crs.dart';
import 'package:flutter_map/src/geo/latlng_bounds.dart';
import 'package:flutter_map/src/layer/general/mobile_layer_transformer.dart';
import 'package:flutter_map/src/map/camera/camera.dart';
import 'package:flutter_map/src/misc/offsets.dart';
import 'package:flutter_map/src/misc/point_extensions.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/src/misc/simplify.dart';
import 'package:latlong2/latlong.dart' hide Path;
import 'package:polylabel/polylabel.dart'; // conflict with Path from UI
Expand Down
6 changes: 3 additions & 3 deletions lib/src/layer/polyline_layer/painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,20 @@ class _PolylinePainter<R extends Object> extends CustomPainter {
: paint.color = polyline.color;
}

if (polyline.borderColor != null && polyline.borderStrokeWidth > 0.0) {
if (polyline.borderStrokeWidth > 0.0) {
// Outlined lines are drawn by drawing a thicker path underneath, then
// stenciling the middle (in case the line fill is transparent), and
// finally drawing the line fill.
borderPaint = Paint()
..color = polyline.borderColor ?? const Color(0x00000000)
..color = polyline.borderColor
..strokeWidth = strokeWidth + polyline.borderStrokeWidth
..strokeCap = polyline.strokeCap
..strokeJoin = polyline.strokeJoin
..style = isDotted ? PaintingStyle.fill : PaintingStyle.stroke
..blendMode = BlendMode.srcOver;

filterPaint = Paint()
..color = polyline.borderColor!.withAlpha(255)
..color = polyline.borderColor.withAlpha(255)
..strokeWidth = strokeWidth
..strokeCap = polyline.strokeCap
..strokeJoin = polyline.strokeJoin
Expand Down
4 changes: 3 additions & 1 deletion lib/src/layer/polyline_layer/polyline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Polyline<R extends Object> {
final double strokeWidth;
final Color color;
final double borderStrokeWidth;
final Color? borderColor;
final Color borderColor;
final List<Color>? gradientColors;
final List<double>? colorsStop;
final bool isDotted;
Expand Down Expand Up @@ -71,6 +71,7 @@ class Polyline<R extends Object> {

// Used to batch draw calls to the canvas
int? _renderHashCode;

int get renderHashCode => _renderHashCode ??= Object.hash(
strokeWidth,
color,
Expand All @@ -86,6 +87,7 @@ class Polyline<R extends Object> {
);

int? _hashCode;

@override
int get hashCode => _hashCode ??= Object.hashAll([...points, renderHashCode]);
}
3 changes: 1 addition & 2 deletions lib/src/layer/tile_layer/tile.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'dart:math';

import 'package:flutter/widgets.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_builder.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_image.dart';
import 'package:flutter_map/flutter_map.dart';

@immutable
class Tile extends StatefulWidget {
Expand Down
4 changes: 1 addition & 3 deletions lib/src/layer/tile_layer/tile_bounds/tile_bounds.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:flutter_map/src/geo/crs.dart';
import 'package:flutter_map/src/geo/latlng_bounds.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_bounds/tile_bounds_at_zoom.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_range.dart';
import 'package:flutter_map/src/misc/bounds.dart';
import 'package:latlong2/latlong.dart';
import 'package:meta/meta.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter_map/src/layer/tile_layer/tile_coordinates.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_range.dart';
import 'package:meta/meta.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/src/layer/tile_layer/tile_builder.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_image.dart';
import 'package:flutter_map/flutter_map.dart';

typedef TileBuilder = Widget Function(
BuildContext context, Widget tileWidget, TileImage tile);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/layer/tile_layer/tile_display.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter_map/src/layer/tile_layer/tile_layer.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:meta/meta.dart';

@immutable
Expand Down
3 changes: 1 addition & 2 deletions lib/src/layer/tile_layer/tile_image.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'dart:async';

import 'package:flutter/widgets.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_coordinates.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_display.dart';
import 'package:flutter_map/flutter_map.dart';

class TileImage extends ChangeNotifier {
bool _disposed = false;
Expand Down
5 changes: 1 addition & 4 deletions lib/src/layer/tile_layer/tile_image_manager.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import 'dart:collection';

import 'package:collection/collection.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_bounds/tile_bounds.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_bounds/tile_bounds_at_zoom.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_coordinates.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_display.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_image.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_image_view.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_layer.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_range.dart';
import 'package:meta/meta.dart';

Expand Down
3 changes: 1 addition & 2 deletions lib/src/layer/tile_layer/tile_image_view.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:collection';

import 'package:flutter_map/src/layer/tile_layer/tile_coordinates.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_image.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_range.dart';

final class TileImageView {
Expand Down
15 changes: 1 addition & 14 deletions lib/src/layer/tile_layer/tile_layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,14 @@ import 'dart:math';
import 'package:collection/collection.dart' show MapEquality;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_map/src/geo/crs.dart';
import 'package:flutter_map/src/geo/latlng_bounds.dart';
import 'package:flutter_map/src/layer/general/mobile_layer_transformer.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/src/layer/tile_layer/tile.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_bounds/tile_bounds.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_bounds/tile_bounds_at_zoom.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_builder.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_coordinates.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_display.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_image.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_image_manager.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_provider/base_tile_provider.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_provider/network_tile_provider.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_range.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_range_calculator.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_scale_calculator.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_update_event.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_update_transformer.dart';
import 'package:flutter_map/src/map/camera/camera.dart';
import 'package:flutter_map/src/map/controller/map_controller.dart';
import 'package:flutter_map/src/misc/bounds.dart';
import 'package:http/retry.dart';
import 'package:logger/logger.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_coordinates.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_layer.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_provider/base_tile_provider.dart';
import 'package:flutter_map/flutter_map.dart';

/// Fetch tiles from the app's shipped assets, where the tile URL is a path
/// within the asset store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import 'dart:typed_data';
import 'dart:ui';

import 'package:flutter/widgets.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_coordinates.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_layer.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_provider/network_tile_provider.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:meta/meta.dart';

/// The base tile provider, extended by other classes with more specialised
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'dart:io';

import 'package:flutter/widgets.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_coordinates.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_layer.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_provider/base_tile_provider.dart';
import 'package:flutter_map/flutter_map.dart';

/// Fetch tiles from the local filesystem (not asset store), where the tile URL
/// is a path within the filesystem.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'package:flutter/rendering.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_coordinates.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_layer.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_provider/base_tile_provider.dart';
import 'package:flutter_map/flutter_map.dart';

/// Fetch tiles from the local filesystem (not asset store), where the tile URL
/// is a path within the filesystem.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import 'dart:async';
import 'dart:collection';

import 'package:flutter/rendering.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_coordinates.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_layer.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_provider/base_tile_provider.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/src/layer/tile_layer/tile_provider/network_image_provider.dart';
import 'package:http/http.dart';
import 'package:http/retry.dart';
Expand Down
Loading

0 comments on commit 2bb0671

Please sign in to comment.