Skip to content

Commit

Permalink
v9.1.0: support flutter_map v7 & Flutter 3.22 (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
JaffaKetchup authored May 27, 2024
1 parent dfee86c commit 5a2b88d
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 38 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ Many thanks to my sponsors, no matter how much or how little they donated. Spons
* @eidolonFIRE
* @weishuhn
* @mohammedX6
* and 3 anonymous or private donors
* @quentinchaignaud
* @Mayb3Nots
* @T-moz
* @micheljung
* \+ more anonymous or private donors

# Changelog

## [9.1.0] - 2024/05/27

* Upgraded to flutter_map v7 to support Flutter 3.22 (also upgraded other dependencies)
* Deprecated `BaseRegion.toDrawable`, and all implementations

## [9.0.1] - 2024/04/29

* Fixed bug on initialisation, where using multiple/background `FlutterEngine`s would attempt to re-open a single ObjectBox Store (aka. root) multiple times
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class RegionShape extends StatelessWidget {
const LatLng(-90, -180),
],
holePointsList: [holePoints],
isFilled: true,
borderColor: Colors.black,
borderStrokeWidth: 2,
color: Theme.of(context).colorScheme.surface.withOpacity(0.5),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class _RegionSelectionPageState extends State<RegionSelectionPage> {

if (provider.regionSelectionMethod ==
RegionSelectionMethod.useMapCenter) {
provider.currentNewPointPos = position.center!;
provider.currentNewPointPos = position.center;

if (provider.regionType == RegionType.customPolygon) {
final coords = provider.coordinates;
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: The example application for 'flutter_map_tile_caching', showcasing
it's functionality and use-cases.
publish_to: "none"

version: 9.0.1
version: 9.1.0

environment:
sdk: ">=3.3.0 <4.0.0"
Expand All @@ -18,8 +18,8 @@ dependencies:
file_picker: ^8.0.3
flutter:
sdk: flutter
flutter_map: ^6.1.0
flutter_map_animations: ^0.6.0
flutter_map: ^7.0.0
flutter_map_animations: ^0.7.0
flutter_map_tile_caching:
google_fonts: ^6.2.1
gpx: ^2.2.2
Expand Down
18 changes: 16 additions & 2 deletions lib/src/regions/base_region.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ part of '../../flutter_map_tile_caching.dart';
///
/// It can be converted to a:
/// - [DownloadableRegion] for downloading: [toDownloadable]
/// - [Widget] layer to be placed in a map: [toDrawable]
/// - list of [LatLng]s forming the outline: [toOutline]
///
/// Extended/implemented by:
Expand All @@ -21,7 +20,6 @@ sealed class BaseRegion {
///
/// It can be converted to a:
/// - [DownloadableRegion] for downloading: [toDownloadable]
/// - [Widget] layer to be placed in a map: [toDrawable]
/// - list of [LatLng]s forming the outline: [toOutline]
///
/// Extended/implemented by:
Expand Down Expand Up @@ -58,6 +56,22 @@ sealed class BaseRegion {
});

/// Generate a graphical layer to be placed in a [FlutterMap]
///
/// **Deprecated.** Instead obtain the outline/line/points using other methods,
/// and render the layer manually. This method is being removed to reduce
/// dependency on flutter_map, and allow full usage of flutter_map
/// functionality without it needing to be semi-implemented here. This feature
/// was deprecated after v9.1.0, and will be removed in the next breaking/major
/// release.
@Deprecated(
'Instead obtain the outline/line/points using other methods, and render the '
'layer manually. '
'This method is being removed to reduce dependency on flutter_map, and allow '
'full usage of flutter_map functionality without it needing to be '
'semi-implemented here. '
'This feature was deprecated after v9.1.0, and will be removed in the next '
'breaking/major release.',
)
Widget toDrawable({
Color? fillColor,
Color borderColor = const Color(0x00000000),
Expand Down
24 changes: 19 additions & 5 deletions lib/src/regions/circle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ part of '../../flutter_map_tile_caching.dart';
///
/// It can be converted to a:
/// - [DownloadableRegion] for downloading: [toDownloadable]
/// - [Widget] layer to be placed in a map: [toDrawable]
/// - list of [LatLng]s forming the outline: [toOutline]
class CircleRegion extends BaseRegion {
/// A geographically circular region based off a [center] coord and [radius]
///
/// It can be converted to a:
/// - [DownloadableRegion] for downloading: [toDownloadable]
/// - [Widget] layer to be placed in a map: [toDrawable]
/// - list of [LatLng]s forming the outline: [toOutline]
const CircleRegion(this.center, this.radius);

Expand Down Expand Up @@ -43,6 +41,21 @@ class CircleRegion extends BaseRegion {
crs: crs,
);

/// **Deprecated.** Instead obtain the outline/line/points using other methods,
/// and render the layer manually. This method is being removed to reduce
/// dependency on flutter_map, and allow full usage of flutter_map
/// functionality without it needing to be semi-implemented here. This feature
/// was deprecated after v9.1.0, and will be removed in the next breaking/major
/// release.
@Deprecated(
'Instead obtain the outline/line/points using other methods, and render the '
'layer manually. '
'This method is being removed to reduce dependency on flutter_map, and allow '
'full usage of flutter_map functionality without it needing to be '
'semi-implemented here. '
'This feature was deprecated after v9.1.0, and will be removed in the next '
'breaking/major release.',
)
@override
PolygonLayer toDrawable({
Color? fillColor,
Expand All @@ -57,11 +70,12 @@ class CircleRegion extends BaseRegion {
polygons: [
Polygon(
points: toOutline().toList(),
isFilled: fillColor != null,
color: fillColor ?? Colors.transparent,
color: fillColor,
borderColor: borderColor,
borderStrokeWidth: borderStrokeWidth,
isDotted: isDotted,
pattern: isDotted
? const StrokePattern.dotted()
: const StrokePattern.solid(),
label: label,
labelStyle: labelStyle,
labelPlacement: labelPlacement,
Expand Down
24 changes: 19 additions & 5 deletions lib/src/regions/custom_polygon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ part of '../../flutter_map_tile_caching.dart';
///
/// It can be converted to a:
/// - [DownloadableRegion] for downloading: [toDownloadable]
/// - [Widget] layer to be placed in a map: [toDrawable]
/// - list of [LatLng]s forming the outline: [toOutline]
class CustomPolygonRegion extends BaseRegion {
/// A geographical region who's outline is defined by a list of coordinates
///
/// It can be converted to a:
/// - [DownloadableRegion] for downloading: [toDownloadable]
/// - [Widget] layer to be placed in a map: [toDrawable]
/// - list of [LatLng]s forming the outline: [toOutline]
const CustomPolygonRegion(this.outline);

Expand All @@ -40,6 +38,21 @@ class CustomPolygonRegion extends BaseRegion {
crs: crs,
);

/// **Deprecated.** Instead obtain the outline/line/points using other methods,
/// and render the layer manually. This method is being removed to reduce
/// dependency on flutter_map, and allow full usage of flutter_map
/// functionality without it needing to be semi-implemented here. This feature
/// was deprecated after v9.1.0, and will be removed in the next breaking/major
/// release.
@Deprecated(
'Instead obtain the outline/line/points using other methods, and render the '
'layer manually. '
'This method is being removed to reduce dependency on flutter_map, and allow '
'full usage of flutter_map functionality without it needing to be '
'semi-implemented here. '
'This feature was deprecated after v9.1.0, and will be removed in the next '
'breaking/major release.',
)
@override
PolygonLayer toDrawable({
Color? fillColor,
Expand All @@ -54,11 +67,12 @@ class CustomPolygonRegion extends BaseRegion {
polygons: [
Polygon(
points: outline,
isFilled: fillColor != null,
color: fillColor ?? Colors.transparent,
color: fillColor,
borderColor: borderColor,
borderStrokeWidth: borderStrokeWidth,
isDotted: isDotted,
pattern: isDotted
? const StrokePattern.dotted()
: const StrokePattern.solid(),
label: label,
labelStyle: labelStyle,
labelPlacement: labelPlacement,
Expand Down
32 changes: 26 additions & 6 deletions lib/src/regions/line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ part of '../../flutter_map_tile_caching.dart';
///
/// It can be converted to a:
/// - [DownloadableRegion] for downloading: [toDownloadable]
/// - [Widget] layer to be placed in a map: [toDrawable]
/// - list of [LatLng]s forming the outline: [LineRegion.toOutlines]
class LineRegion extends BaseRegion {
/// A geographically line/locus region based off a list of coords and a [radius]
///
/// It can be converted to a:
/// - [DownloadableRegion] for downloading: [toDownloadable]
/// - [Widget] layer to be placed in a map: [toDrawable]
/// - list of [LatLng]s forming the outline: [LineRegion.toOutlines]
const LineRegion(this.line, this.radius);

Expand Down Expand Up @@ -91,6 +89,25 @@ class LineRegion extends BaseRegion {
crs: crs,
);

/// **Deprecated.** Instead obtain the outline/line/points using other methods,
/// and render the layer manually. This method is being removed to reduce
/// dependency on flutter_map, and allow full usage of flutter_map
/// functionality without it needing to be semi-implemented here. This feature
/// was deprecated after v9.1.0, and will be removed in the next breaking/major
/// release.
///
/// If `prettyPaint` was `true`, render a `Polyline` based on [line] and
/// [radius]. Otherwise, render multiple `Polygons` based on the result of
/// `toOutlines(1)`.
@Deprecated(
'Instead obtain the outline/line/points using other methods, and render the '
'layer manually. '
'This method is being removed to reduce dependency on flutter_map, and allow '
'full usage of flutter_map functionality without it needing to be '
'semi-implemented here. '
'This feature was deprecated after v9.1.0, and will be removed in the next '
'breaking/major release.',
)
@override
Widget toDrawable({
Color? fillColor,
Expand All @@ -113,7 +130,9 @@ class LineRegion extends BaseRegion {
color: fillColor ?? const Color(0x00000000),
borderColor: borderColor ?? const Color(0x00000000),
borderStrokeWidth: borderStrokeWidth,
isDotted: isDotted,
pattern: isDotted
? const StrokePattern.dotted()
: const StrokePattern.solid(),
gradientColors: gradientColors,
colorsStop: colorsStop,
strokeCap: strokeCap,
Expand All @@ -126,11 +145,12 @@ class LineRegion extends BaseRegion {
.map(
(rect) => Polygon(
points: rect,
isFilled: fillColor != null,
color: fillColor ?? Colors.transparent,
color: fillColor,
borderColor: borderColor ?? const Color(0x00000000),
borderStrokeWidth: borderStrokeWidth,
isDotted: isDotted,
pattern: isDotted
? const StrokePattern.dotted()
: const StrokePattern.solid(),
strokeCap: strokeCap,
strokeJoin: strokeJoin,
),
Expand Down
24 changes: 19 additions & 5 deletions lib/src/regions/rectangle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ part of '../../flutter_map_tile_caching.dart';
///
/// It can be converted to a:
/// - [DownloadableRegion] for downloading: [toDownloadable]
/// - [Widget] layer to be placed in a map: [toDrawable]
/// - list of [LatLng]s forming the outline: [toOutline]
class RectangleRegion extends BaseRegion {
/// A geographically rectangular region based off coordinate bounds
///
/// It can be converted to a:
/// - [DownloadableRegion] for downloading: [toDownloadable]
/// - [Widget] layer to be placed in a map: [toDrawable]
/// - list of [LatLng]s forming the outline: [toOutline]
const RectangleRegion(this.bounds);

Expand All @@ -42,6 +40,21 @@ class RectangleRegion extends BaseRegion {
crs: crs,
);

/// **Deprecated.** Instead obtain the outline/line/points using other methods,
/// and render the layer manually. This method is being removed to reduce
/// dependency on flutter_map, and allow full usage of flutter_map
/// functionality without it needing to be semi-implemented here. This feature
/// was deprecated after v9.1.0, and will be removed in the next breaking/major
/// release.
@Deprecated(
'Instead obtain the outline/line/points using other methods, and render the '
'layer manually. '
'This method is being removed to reduce dependency on flutter_map, and allow '
'full usage of flutter_map functionality without it needing to be '
'semi-implemented here. '
'This feature was deprecated after v9.1.0, and will be removed in the next '
'breaking/major release.',
)
@override
PolygonLayer toDrawable({
Color? fillColor,
Expand All @@ -55,11 +68,12 @@ class RectangleRegion extends BaseRegion {
PolygonLayer(
polygons: [
Polygon(
isFilled: fillColor != null,
color: fillColor ?? Colors.transparent,
color: fillColor,
borderColor: borderColor,
borderStrokeWidth: borderStrokeWidth,
isDotted: isDotted,
pattern: isDotted
? const StrokePattern.dotted()
: const StrokePattern.solid(),
label: label,
labelStyle: labelStyle,
labelPlacement: labelPlacement,
Expand Down
16 changes: 8 additions & 8 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_map_tile_caching
description: Plugin for 'flutter_map' providing advanced caching functionality,
with ability to download map regions for offline use.
version: 9.0.1
version: 9.1.0

repository: https://github.com/JaffaKetchup/flutter_map_tile_caching
issue_tracker: https://github.com/JaffaKetchup/flutter_map_tile_caching/issues
Expand Down Expand Up @@ -33,19 +33,19 @@ dependencies:
flat_buffers: ^23.5.26
flutter:
sdk: flutter
flutter_map: ^6.1.0
flutter_map: ^7.0.0
http: ^1.2.1
latlong2: ^0.9.1
meta: ^1.11.0
objectbox: ^2.5.1
objectbox_flutter_libs: ^2.5.1
meta: ^1.12.0
objectbox: ^4.0.1
objectbox_flutter_libs: ^4.0.1
path: ^1.9.0
path_provider: ^2.1.3

dev_dependencies:
build_runner: ^2.4.9
objectbox_generator: ^2.5.1
test: ^1.25.2
build_runner: ^2.4.0
objectbox_generator: ^4.0.1
test: ^1.25.0

flutter: null

Expand Down
2 changes: 1 addition & 1 deletion windowsApplicationInstallerSetup.iss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard

#define MyAppName "FMTC Demo"
#define MyAppVersion "for 9.0.1"
#define MyAppVersion "for 9.1.0"
#define MyAppPublisher "JaffaKetchup Development"
#define MyAppURL "https://github.com/JaffaKetchup/flutter_map_tile_caching"
#define MyAppSupportURL "https://github.com/JaffaKetchup/flutter_map_tile_caching/issues"
Expand Down

0 comments on commit 5a2b88d

Please sign in to comment.