From 4956693091a9dfe64dc37556e3defc0e9fc4ae01 Mon Sep 17 00:00:00 2001 From: Guilherme Galambas Date: Thu, 4 Apr 2024 14:41:33 +0100 Subject: [PATCH 1/3] added parameters --- packages/atlas/lib/src/atlas.dart | 11 +++++++++++ packages/atlas/lib/src/provider.dart | 2 ++ 2 files changed, 13 insertions(+) diff --git a/packages/atlas/lib/src/atlas.dart b/packages/atlas/lib/src/atlas.dart index 4db9be4..ef59573 100644 --- a/packages/atlas/lib/src/atlas.dart +++ b/packages/atlas/lib/src/atlas.dart @@ -145,6 +145,13 @@ class Atlas extends StatelessWidget { /// Callback executed when the map is loaded and is on the screen final Heatmap? heatmap; + /// Clusters the markers into groups + final bool cluster; + + /// Called when a cluster is tapped. + /// The Markers of the pressed cluster are passed as an argument. + final ValueChanged>? onClusterTap; + Atlas({ Key? key, required this.initialCameraPosition, @@ -179,6 +186,8 @@ class Atlas extends StatelessWidget { this.onPolylineTap, this.onMapLoaded, this.heatmap, + this.cluster = false, + this.onClusterTap, }) : markers = markers ?? Set(), callouts = callouts ?? Set(), circles = circles ?? Set(), @@ -229,6 +238,8 @@ class Atlas extends StatelessWidget { onPolylineTap: onPolylineTap, onMapLoaded: onMapLoaded, heatmap: heatmap, + cluster: cluster, + onClusterTap: onClusterTap, ); } } diff --git a/packages/atlas/lib/src/provider.dart b/packages/atlas/lib/src/provider.dart index 4d9055b..b5df997 100644 --- a/packages/atlas/lib/src/provider.dart +++ b/packages/atlas/lib/src/provider.dart @@ -49,5 +49,7 @@ abstract class Provider { final double? maxZoom, final VoidCallback? onMapLoaded, final Heatmap? heatmap, + final bool cluster, + final ValueChanged>? onClusterTap, }); } From 7da58ea50ffdd8c5e49325cdafdc70f38e88a4aa Mon Sep 17 00:00:00 2001 From: Guilherme Galambas Date: Mon, 20 May 2024 17:34:19 +0100 Subject: [PATCH 2/3] cluster options --- packages/atlas/lib/atlas.dart | 1 + packages/atlas/lib/src/atlas.dart | 13 ++++------- packages/atlas/lib/src/cluster_options.dart | 25 +++++++++++++++++++++ packages/atlas/lib/src/provider.dart | 5 +++-- 4 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 packages/atlas/lib/src/cluster_options.dart diff --git a/packages/atlas/lib/atlas.dart b/packages/atlas/lib/atlas.dart index f6f16ca..ff9c380 100644 --- a/packages/atlas/lib/atlas.dart +++ b/packages/atlas/lib/atlas.dart @@ -10,6 +10,7 @@ export 'src/camera_position.dart'; export 'src/circle.dart'; export 'src/cluster.dart'; export 'src/cluster_icon.dart'; +export 'src/cluster_options.dart'; export 'src/congestion_level_route.dart'; export 'src/device_location.dart'; export 'src/heatmap/heatcolor.dart'; diff --git a/packages/atlas/lib/src/atlas.dart b/packages/atlas/lib/src/atlas.dart index ef59573..7362bb9 100644 --- a/packages/atlas/lib/src/atlas.dart +++ b/packages/atlas/lib/src/atlas.dart @@ -1,4 +1,5 @@ import 'package:atlas/atlas.dart'; +import 'package:atlas/src/cluster_options.dart'; import 'package:flutter/widgets.dart'; /// `Atlas` is a Flutter [Widget] which abstracts the underlying map provider @@ -146,11 +147,7 @@ class Atlas extends StatelessWidget { final Heatmap? heatmap; /// Clusters the markers into groups - final bool cluster; - - /// Called when a cluster is tapped. - /// The Markers of the pressed cluster are passed as an argument. - final ValueChanged>? onClusterTap; + final ClusterOptions? clusterOptions; Atlas({ Key? key, @@ -186,8 +183,7 @@ class Atlas extends StatelessWidget { this.onPolylineTap, this.onMapLoaded, this.heatmap, - this.cluster = false, - this.onClusterTap, + this.clusterOptions, }) : markers = markers ?? Set(), callouts = callouts ?? Set(), circles = circles ?? Set(), @@ -238,8 +234,7 @@ class Atlas extends StatelessWidget { onPolylineTap: onPolylineTap, onMapLoaded: onMapLoaded, heatmap: heatmap, - cluster: cluster, - onClusterTap: onClusterTap, + clusterOptions: clusterOptions, ); } } diff --git a/packages/atlas/lib/src/cluster_options.dart b/packages/atlas/lib/src/cluster_options.dart new file mode 100644 index 0000000..d9a9347 --- /dev/null +++ b/packages/atlas/lib/src/cluster_options.dart @@ -0,0 +1,25 @@ +import 'package:atlas/atlas.dart'; +import 'package:flutter/widgets.dart'; + +/// Cluster customization +class ClusterOptions { + /// Whether to cluster the markers into groups + final bool enabled; + + /// Called when a cluster is tapped. + /// The Markers of the pressed cluster are passed as an argument. + final ValueChanged>? onTap; + + /// Icon used for the clustered markers + final MarkerIcon icon; + + /// Text color of the cluster counter + final Color textColor; + + ClusterOptions({ + this.enabled = true, + this.onTap, + required this.icon, + required this.textColor, + }); +} diff --git a/packages/atlas/lib/src/provider.dart b/packages/atlas/lib/src/provider.dart index b5df997..699d631 100644 --- a/packages/atlas/lib/src/provider.dart +++ b/packages/atlas/lib/src/provider.dart @@ -1,6 +1,8 @@ import 'package:atlas/atlas.dart'; import 'package:flutter/widgets.dart'; +import 'cluster_options.dart'; + /// Callback function taking a single argument. typedef void ArgumentCallback(T argument); @@ -49,7 +51,6 @@ abstract class Provider { final double? maxZoom, final VoidCallback? onMapLoaded, final Heatmap? heatmap, - final bool cluster, - final ValueChanged>? onClusterTap, + final ClusterOptions? clusterOptions, }); } From 919b329f0a4921d61827b13b47e044b8bd180626 Mon Sep 17 00:00:00 2001 From: Guilherme Galambas Date: Tue, 21 May 2024 09:38:53 +0100 Subject: [PATCH 3/3] versioning --- packages/atlas/CHANGELOG.md | 4 ++++ packages/atlas/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/atlas/CHANGELOG.md b/packages/atlas/CHANGELOG.md index 1c4d95d..a019ccb 100644 --- a/packages/atlas/CHANGELOG.md +++ b/packages/atlas/CHANGELOG.md @@ -1,5 +1,9 @@ # atlas +## v1.3.0 (2024-05-21) + +- Added support for `Clustering` + ## v1.2.0 (2024-05-09) - Added enum value `threeDimensional` for `MapType` diff --git a/packages/atlas/pubspec.yaml b/packages/atlas/pubspec.yaml index cb23388..3b5f10c 100644 --- a/packages/atlas/pubspec.yaml +++ b/packages/atlas/pubspec.yaml @@ -1,6 +1,6 @@ name: atlas description: An extensible map abstraction for Flutter with support for multiple map providers -version: 1.2.0 +version: 1.3.0 repository: https://github.com/bmw-tech/atlas issue_tracker: https://github.com/bmw-tech/atlas/issues homepage: https://bmw-tech.github.io/atlas