Skip to content

Commit

Permalink
New Property allowPanning (#766)
Browse files Browse the repository at this point in the history
* patched version

* V0.10.2

* fix if PolylineOption.borderColor==null

* Fixup build errors for the web example (#782)

* Add new required environment spec

Otherwise flutter throws an error and abort building.

Fixes #774

* Update usage of API for text colors

As suggested by joselbr2099 the API have changed in flutter. Replace
only colors parameter with textColor.

Fixes #774

* remove mbtiles tile provider + sqflite dependency (#787)

* remove mbtiles and sqlflite dependency

* remove mbtiles tile provider + sqflite dependency

fixes #786

* remove example/test/widget_test

* updated to latest master version

* formatting code

Co-authored-by: nickoe <oe.nick@gmail.com>
Co-authored-by: John Ryan <ryjohn@google.com>
  • Loading branch information
3 people committed Jan 8, 2021
1 parent c63e93a commit 15a7937
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 12 deletions.
99 changes: 99 additions & 0 deletions .packages
@@ -0,0 +1,99 @@
# Generated by pub on 2021-01-08 01:21:05.841448.
_fe_analyzer_shared:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-12.0.0/lib/
analyzer:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.6/lib/
ansicolor:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/ansicolor-1.1.1/lib/
archive:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/archive-2.0.13/lib/
args:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib/
async:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.5.0-nullsafety.1/lib/
boolean_selector:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0-nullsafety.1/lib/
cached_network_image:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/cached_network_image-2.5.0/lib/
characters:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0-nullsafety.3/lib/
charcode:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0-nullsafety.1/lib/
cli_util:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/cli_util-0.2.0/lib/
clock:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0-nullsafety.1/lib/
collection:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0-nullsafety.3/lib/
console_log_handler:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/console_log_handler-1.1.6/lib/
convert:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib/
coverage:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/coverage-0.14.2/lib/
crypto:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-2.1.5/lib/
fake_async:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0-nullsafety.1/lib/
ffi:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/
file:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/file-5.2.1/lib/
flutter:file:///Users/escmoteur/Entwicklung/flutter/packages/flutter/lib/
flutter_blurhash:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blurhash-0.5.0/lib/
flutter_cache_manager:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_cache_manager-2.1.0/lib/
flutter_image:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_image-3.0.0/lib/
flutter_test:file:///Users/escmoteur/Entwicklung/flutter/packages/flutter_test/lib/
glob:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/glob-1.2.0/lib/
http:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.2/lib/
http_multi_server:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.2.0/lib/
http_parser:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.4/lib/
image:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/
intl:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/
io:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/io-0.3.4/lib/
js:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.3-nullsafety.2/lib/
latlong:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/latlong-0.6.1/lib/
lists:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/lists-0.1.6/lib/
location:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/location-2.5.4/lib/
logging:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/logging-0.11.4/lib/
matcher:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.10-nullsafety.1/lib/
meta:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.3/lib/
mgrs_dart:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/mgrs_dart-1.0.1/lib/
mime:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/mime-0.9.7/lib/
node_interop:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/node_interop-1.2.1/lib/
node_io:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/node_io-1.2.0/lib/
node_preamble:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.12/lib/
octo_image:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/octo_image-0.3.0/lib/
package_config:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/package_config-1.9.3/lib/
path:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety.1/lib/
path_provider:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.24/lib/
path_provider_linux:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/lib/
path_provider_macos:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+6/lib/
path_provider_platform_interface:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_platform_interface-1.0.4/lib/
path_provider_windows:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+3/lib/
pedantic:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.10.0-nullsafety.2/lib/
petitparser:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/petitparser-3.1.0/lib/
platform:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/platform-2.2.1/lib/
plugin_platform_interface:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/plugin_platform_interface-1.0.3/lib/
pool:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/pool-1.5.0-nullsafety.2/lib/
positioned_tap_detector:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/positioned_tap_detector-1.0.3/lib/
process:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/process-3.0.13/lib/
proj4dart:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/proj4dart-1.0.5/lib/
pub_semver:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.4/lib/
quiver:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.1.5/lib/
rxdart:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/rxdart-0.25.0/lib/
shelf:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.9/lib/
shelf_packages_handler:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-2.0.0/lib/
shelf_static:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.9+1/lib/
shelf_web_socket:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.3/lib/
sky_engine:file:///Users/escmoteur/Entwicklung/flutter/bin/cache/pkg/sky_engine/lib/
source_map_stack_trace:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-2.1.0-nullsafety.3/lib/
source_maps:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.10-nullsafety.2/lib/
source_span:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.0-nullsafety.2/lib/
sqflite:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.2+1/lib/
sqflite_common:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite_common-1.0.2+1/lib/
stack_trace:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0-nullsafety.1/lib/
stream_channel:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.0-nullsafety.1/lib/
string_scanner:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.1.0-nullsafety.1/lib/
synchronized:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/synchronized-2.2.0+2/lib/
term_glyph:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0-nullsafety.1/lib/
test:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/test-1.16.0-nullsafety.5/lib/
test_api:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.19-nullsafety.2/lib/
test_core:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/test_core-0.3.12-nullsafety.5/lib/
transparent_image:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/transparent_image-1.0.0/lib/
tuple:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/tuple-1.0.3/lib/
typed_data:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0-nullsafety.3/lib/
unicode:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/unicode-0.2.4/lib/
uuid:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/uuid-2.2.2/lib/
validate:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/validate-1.7.0/lib/
vector_math:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.0-nullsafety.3/lib/
vm_service:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/vm_service-5.5.0/lib/
watcher:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+15/lib/
web_socket_channel:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.1.0/lib/
webkit_inspection_protocol:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/webkit_inspection_protocol-0.7.4/lib/
win32:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/
wkt_parser:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/wkt_parser-1.0.7/lib/
xdg_directories:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/xdg_directories-0.1.2/lib/
xml:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/xml-4.5.1/lib/
yaml:file:///Users/escmoteur/Entwicklung/flutter/.pub-cache/hosted/pub.dartlang.org/yaml-2.2.1/lib/
flutter_map:lib/
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
## [0.10.2] - 10/29/2020
- added property `allowPanning` to `MapOptions` that allows to disable only panning while touch events are still triggered

## [0.10.1+1] - 8/4/2020
- fix possible issue with code published in previous version

Expand Down
2 changes: 1 addition & 1 deletion flutter_map.iml
Expand Up @@ -16,4 +16,4 @@
<orderEntry type="library" name="Dart Packages" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
</component>
</module>
</module>
2 changes: 2 additions & 0 deletions lib/flutter_map.dart
Expand Up @@ -127,6 +127,7 @@ class MapOptions {
@deprecated
final bool debug; // TODO no usage outside of constructor. Marked for removal?
final bool interactive;
final bool allowPanning;
final TapCallback onTap;
final LongPressCallback onLongPress;
final PositionCallback onPositionChanged;
Expand Down Expand Up @@ -155,6 +156,7 @@ class MapOptions {
this.maxZoom,
this.debug = false,
this.interactive = true,
this.allowPanning = true,
this.onTap,
this.onLongPress,
this.onPositionChanged,
Expand Down
13 changes: 12 additions & 1 deletion lib/src/gestures/gestures.dart
Expand Up @@ -71,14 +71,21 @@ abstract class MapGestureMixin extends State<FlutterMap>
final focalStartPt = map.project(_focalStartGlobal, newZoom);
final newCenterPt = focalStartPt - focalOffset + map.size / 2.0;
final newCenter = map.unproject(newCenterPt, newZoom);
map.move(newCenter, newZoom, hasGesture: true);
if (options.allowPanning) {
map.move(newCenter, newZoom, hasGesture: true);
} else {
map.move(map.center, newZoom, hasGesture: true);
}
_flingOffset = _pointToOffset(_focalStartLocal - focalOffset);
});
}

void handleScaleEnd(ScaleEndDetails details) {
_resetDoubleTapHold();

if (!options.allowPanning) {
return;
}
var magnitude = details.velocity.pixelsPerSecond.distance;
if (magnitude < _kMinFlingVelocity) {
return;
Expand Down Expand Up @@ -140,6 +147,10 @@ abstract class MapGestureMixin extends State<FlutterMap>
void handleDoubleTap(TapPosition tapPosition) {
_resetDoubleTapHold();

if (!options.allowPanning) {
return;
}

final centerPos = _pointToOffset(map.size) / 2.0;
final newZoom = _getZoomForScale(map.zoom, 2.0);
final focalDelta = _getDoubleTapFocalDelta(
Expand Down
23 changes: 14 additions & 9 deletions lib/src/layer/polyline_layer.dart
Expand Up @@ -150,12 +150,15 @@ class PolylinePainter extends CustomPainter {
: paint.color = polylineOpt.color;
}

final filterPaint = Paint()
..color = polylineOpt.borderColor.withAlpha(255)
..strokeWidth = polylineOpt.strokeWidth
..strokeCap = StrokeCap.round
..strokeJoin = StrokeJoin.round
..blendMode = BlendMode.dstOut;
Paint filterPaint;
if (polylineOpt.borderColor != null) {
filterPaint = Paint()
..color = polylineOpt.borderColor.withAlpha(255)
..strokeWidth = polylineOpt.strokeWidth
..strokeCap = StrokeCap.round
..strokeJoin = StrokeJoin.round
..blendMode = BlendMode.dstOut;
}

final borderPaint = polylineOpt.borderStrokeWidth > 0.0
? (Paint()
Expand All @@ -181,11 +184,13 @@ class PolylinePainter extends CustomPainter {
canvas.restore();
} else {
paint.style = PaintingStyle.stroke;
filterPaint.style = PaintingStyle.stroke;
borderPaint?.style = PaintingStyle.stroke;
canvas.saveLayer(rect, Paint());
if (borderPaint != null) {
_paintLine(canvas, polylineOpt.offsets, borderPaint);
if (filterPaint != null) {
filterPaint.style = PaintingStyle.stroke;
_paintLine(canvas, polylineOpt.offsets, borderPaint);
}
borderPaint?.style = PaintingStyle.stroke;
_paintLine(canvas, polylineOpt.offsets, filterPaint);
}
_paintLine(canvas, polylineOpt.offsets, paint);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,6 +1,6 @@
name: flutter_map
description: A Dart implementation of Leaflet for Flutter apps
version: 0.10.1+1
version: 0.10.2
homepage: https://github.com/johnpryan/flutter_map
module:
androidX: true
Expand Down

0 comments on commit 15a7937

Please sign in to comment.