Skip to content

Commit 2e9d424

Browse files
committed
v1.0.0 - Migrate to null safety
1 parent 22223a7 commit 2e9d424

28 files changed

+305
-351
lines changed

.DS_Store

-6 KB
Binary file not shown.

.flutter-plugins

-3
This file was deleted.

.flutter-plugins-dependencies

-1
This file was deleted.

.gitignore

+70-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,77 @@
1-
# Files and directories created by pub
2-
.dart_tool/
3-
.packages
4-
# Remove the following pattern if you wish to check in your lock file
5-
pubspec.lock
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
611

7-
# Conventional directory for build outputs
8-
build/
9-
coverage/
10-
11-
# Directory created by dartdoc
12-
doc/api/
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
1317

1418
# Api key files
1519
**/example/android/app/src/main/res/values/strings.xml
1620
**/example/ios/Runner/Secrets.swift
1721

1822
# Visual Studio Code related
19-
.vscode/
23+
.vscode/
24+
25+
# Flutter/Dart/Pub related
26+
**/doc/api/
27+
.dart_tool/
28+
.flutter-plugins
29+
.flutter-plugins-dependencies
30+
.packages
31+
pubspec.lock
32+
.pub-cache/
33+
.pub/
34+
build/
35+
36+
# Android related
37+
**/android/**/gradle-wrapper.jar
38+
**/android/.gradle
39+
**/android/captures/
40+
**/android/gradlew
41+
**/android/gradlew.bat
42+
**/android/local.properties
43+
**/android/**/GeneratedPluginRegistrant.java
44+
45+
# iOS/XCode related
46+
**/ios/**/*.mode1v3
47+
**/ios/**/*.mode2v3
48+
**/ios/**/*.moved-aside
49+
**/ios/**/*.pbxuser
50+
**/ios/**/*.perspectivev3
51+
**/ios/**/*sync/
52+
**/ios/**/.sconsign.dblite
53+
**/ios/**/.tags*
54+
**/ios/**/.vagrant/
55+
**/ios/**/DerivedData/
56+
**/ios/**/Icon?
57+
**/ios/**/Pods/
58+
**/ios/**/.symlinks/
59+
**/ios/**/profile
60+
**/ios/**/xcuserdata
61+
**/ios/.generated/
62+
**/ios/Flutter/App.framework
63+
**/ios/Flutter/Flutter.framework
64+
**/ios/Flutter/Flutter.podspec
65+
**/ios/Flutter/Generated.xcconfig
66+
**/ios/Flutter/app.flx
67+
**/ios/Flutter/app.zip
68+
**/ios/Flutter/flutter_assets/
69+
**/ios/Flutter/flutter_export_environment.sh
70+
**/ios/ServiceDefinitions.json
71+
**/ios/Runner/GeneratedPluginRegistrant.*
72+
73+
# Exceptions to above rules.
74+
!**/ios/**/default.mode1v3
75+
!**/ios/**/default.mode2v3
76+
!**/ios/**/default.pbxuser
77+
!**/ios/**/default.perspectivev3

.idea/libraries/Dart_SDK.xml

-19
This file was deleted.

.idea/modules.xml

-8
This file was deleted.

.idea/workspace.xml

-36
This file was deleted.

.metadata

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 9f5ff2306bb3e30b2b98eee79cd231b1336f41f4
7+
revision: 60bd88df915880d23877bfc1602e8ddcf4c4dd2a
88
channel: stable
99

1010
project_type: package

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.0.0
2+
3+
- Migrate to null safety
4+
- Internalising geohash to make it null safety compatible
5+
- Temporary : remove `google_maps_flutter_web` because it needs a reorganization of the project to work correctly (& it's not null safety compatible for the moment)
6+
17
## 0.3.0
28

39
- Add `google_maps_flutter_web` dependency to be compatible with Flutter web

README.md

+3-132
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ To start with Cluster Manager, you have to initialize a `ClusterManager` instanc
2424
ClusterManager<Place>(
2525
_items, // Your items to be clustered on the map (of Place type for this example)
2626
_updateMarkers, // Method to be called when markers are updated
27-
markerBuilder: _markerBuilder, // Optional : Method to implement if you want to customise markers
27+
markerBuilder: _markerBuilder, // Optional : Method to implement if you want to customize markers
2828
levels: [1, 4.25, 6.75, 8.25, 11.5, 14.5, 16.0, 16.5, 20.0], // Optional : Configure this if you want to change zoom levels at which the clustering precision change
2929
extraPercent: 0.2, // Optional : This number represents the percentage (0.2 for 20%) of latitude and longitude (in each direction) to be considered on top of the visible map bounds to render clusters. This way, clusters don't "pop out" when you cross the map.
3030
initialZoom: 5.0, // Optional : The initial zoom of your map to be able to render good clusters on map creation
@@ -34,7 +34,7 @@ ClusterManager<Place>(
3434

3535
You are able to add an new item to the map by calling `addItem` method on your `ClusterManager` instance. You can also completely change the items on your maps by calling `setItems` method.
3636

37-
You can customise the icon of a cluster by using `Future<Marker> Function(Cluster<T>) markerBuilder` parameter.
37+
You can customize the icon of a cluster by using `Future<Marker> Function(Cluster<T>) markerBuilder` parameter.
3838

3939
```dart
4040
static Future<Marker> Function(Cluster) get markerBuilder => (cluster) async {
@@ -49,7 +49,7 @@ static Future<Marker> Function(Cluster) get markerBuilder => (cluster) async {
4949
);
5050
};
5151
52-
static Future<BitmapDescriptor> getClusterBitmap(int size, {String text}) async {
52+
static Future<BitmapDescriptor> getClusterBitmap(int size, {String text?}) async {
5353
final PictureRecorder pictureRecorder = PictureRecorder();
5454
final Canvas canvas = Canvas(pictureRecorder);
5555
final Paint paint1 = Paint()..color = Colors.red;
@@ -83,133 +83,4 @@ Every cluster (even one item clusters) is rendered by the library as a `Cluster<
8383

8484
## Complete Basic Example
8585

86-
```dart
87-
class MapSample extends StatefulWidget {
88-
@override
89-
State<MapSample> createState() => MapSampleState();
90-
}
91-
92-
class MapSampleState extends State<MapSample> {
93-
ClusterManager _manager;
94-
95-
Completer<GoogleMapController> _controller = Completer();
96-
97-
Set<Marker> markers = Set();
98-
99-
final CameraPosition _parisCameraPosition =
100-
CameraPosition(target: LatLng(48.856613, 2.352222), zoom: 12.0);
101-
102-
List<ClusterItem<Place>> items = [
103-
for (int i = 0; i < 10; i++)
104-
ClusterItem(LatLng(48.848200 + i * 0.001, 2.319124 + i * 0.001),
105-
item: Place(name: 'Place $i')),
106-
for (int i = 0; i < 10; i++)
107-
ClusterItem(LatLng(48.858265 - i * 0.001, 2.350107 + i * 0.001),
108-
item: Place(name: 'Restaurant $i', isClosed: i % 2 == 0)),
109-
for (int i = 0; i < 10; i++)
110-
ClusterItem(LatLng(48.858265 + i * 0.01, 2.350107 - i * 0.01),
111-
item: Place(name: 'Bar $i')),
112-
for (int i = 0; i < 10; i++)
113-
ClusterItem(LatLng(48.858265 - i * 0.1, 2.350107 - i * 0.01),
114-
item: Place(name: 'Hotel $i')),
115-
for (int i = 0; i < 10; i++)
116-
ClusterItem(LatLng(48.858265 + i * 0.1, 2.350107 + i * 0.1)),
117-
for (int i = 0; i < 10; i++)
118-
ClusterItem(LatLng(48.858265 + i * 1, 2.350107 + i * 1)),
119-
];
120-
121-
@override
122-
void initState() {
123-
_manager = _initClusterManager();
124-
super.initState();
125-
}
126-
127-
ClusterManager _initClusterManager() {
128-
return ClusterManager<Place>(items, _updateMarkers,
129-
markerBuilder: _markerBuilder, initialZoom: _parisCameraPosition.zoom);
130-
}
131-
132-
void _updateMarkers(Set<Marker> markers) {
133-
print('Updated ${markers.length} markers');
134-
setState(() {
135-
this.markers = markers;
136-
});
137-
}
138-
139-
@override
140-
Widget build(BuildContext context) {
141-
return new Scaffold(
142-
body: GoogleMap(
143-
mapType: MapType.normal,
144-
initialCameraPosition: _parisCameraPosition,
145-
markers: markers,
146-
onMapCreated: (GoogleMapController controller) {
147-
_controller.complete(controller);
148-
_manager.setMapController(controller);
149-
},
150-
onCameraMove: _manager.onCameraMove,
151-
onCameraIdle: _manager.updateMap),
152-
floatingActionButton: FloatingActionButton(
153-
onPressed: () {
154-
_manager.setItems(<ClusterItem<Place>>[
155-
for (int i = 0; i < 30; i++)
156-
ClusterItem<Place>(LatLng(48.858265 + i * 0.01, 2.350107),
157-
item: Place(name: 'New Place ${DateTime.now()}'))
158-
]);
159-
},
160-
child: Icon(Icons.update),
161-
),
162-
);
163-
}
164-
165-
Future<Marker> Function(Cluster<Place>) get _markerBuilder =>
166-
(cluster) async {
167-
return Marker(
168-
markerId: MarkerId(cluster.getId()),
169-
position: cluster.location,
170-
onTap: () {
171-
print('---- $cluster');
172-
cluster.items.forEach((p) => print(p));
173-
},
174-
icon: await _getMarkerBitmap(cluster.isMultiple ? 125 : 75,
175-
text: cluster.isMultiple ? cluster.count.toString() : null),
176-
);
177-
};
178-
179-
Future<BitmapDescriptor> _getMarkerBitmap(int size, {String text}) async {
180-
assert(size != null);
181-
182-
final PictureRecorder pictureRecorder = PictureRecorder();
183-
final Canvas canvas = Canvas(pictureRecorder);
184-
final Paint paint1 = Paint()..color = Colors.red;
185-
final Paint paint2 = Paint()..color = Colors.white;
186-
187-
canvas.drawCircle(Offset(size / 2, size / 2), size / 2.0, paint1);
188-
canvas.drawCircle(Offset(size / 2, size / 2), size / 2.2, paint2);
189-
canvas.drawCircle(Offset(size / 2, size / 2), size / 2.8, paint1);
190-
191-
if (text != null) {
192-
TextPainter painter = TextPainter(textDirection: TextDirection.ltr);
193-
painter.text = TextSpan(
194-
text: text,
195-
style: TextStyle(
196-
fontSize: size / 3,
197-
color: Colors.white,
198-
fontWeight: FontWeight.normal),
199-
);
200-
painter.layout();
201-
painter.paint(
202-
canvas,
203-
Offset(size / 2 - painter.width / 2, size / 2 - painter.height / 2),
204-
);
205-
}
206-
207-
final img = await pictureRecorder.endRecording().toImage(size, size);
208-
final data = await img.toByteData(format: ImageByteFormat.png);
209-
210-
return BitmapDescriptor.fromBytes(data.buffer.asUint8List());
211-
}
212-
}
213-
```
214-
21586
See the `example` directory for a complete sample app.

example/.vscode/launch.json

-13
This file was deleted.

example/.vscode/settings.json

-3
This file was deleted.

example/ios/Runner.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
TargetAttributes = {
172172
97C146ED1CF9000F007C117D = {
173173
CreatedOnToolsVersion = 7.3.1;
174+
DevelopmentTeam = Q46ADN6S6V;
174175
LastSwiftMigration = 1100;
175176
};
176177
};
@@ -368,6 +369,7 @@
368369
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
369370
CLANG_ENABLE_MODULES = YES;
370371
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
372+
DEVELOPMENT_TEAM = Q46ADN6S6V;
371373
ENABLE_BITCODE = NO;
372374
FRAMEWORK_SEARCH_PATHS = (
373375
"$(inherited)",
@@ -500,6 +502,7 @@
500502
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
501503
CLANG_ENABLE_MODULES = YES;
502504
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
505+
DEVELOPMENT_TEAM = Q46ADN6S6V;
503506
ENABLE_BITCODE = NO;
504507
FRAMEWORK_SEARCH_PATHS = (
505508
"$(inherited)",
@@ -527,6 +530,7 @@
527530
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
528531
CLANG_ENABLE_MODULES = YES;
529532
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
533+
DEVELOPMENT_TEAM = Q46ADN6S6V;
530534
ENABLE_BITCODE = NO;
531535
FRAMEWORK_SEARCH_PATHS = (
532536
"$(inherited)",

0 commit comments

Comments
 (0)