diff --git a/place_tracker/analysis_options.yaml b/place_tracker/analysis_options.yaml
new file mode 100644
index 000000000..1a52a34fc
--- /dev/null
+++ b/place_tracker/analysis_options.yaml
@@ -0,0 +1,10 @@
+analyzer:
+ errors:
+ # treat missing required parameters as a warning (not a hint)
+ missing_required_param: warning
+ # treat missing returns as a warning (not a hint)
+ missing_return: warning
+
+linter:
+ rules:
+ - unawaited_futures
diff --git a/place_tracker/ios/Podfile b/place_tracker/ios/Podfile
index 7c6cb6f63..b31234135 100644
--- a/place_tracker/ios/Podfile
+++ b/place_tracker/ios/Podfile
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
-# platform :ios, '9.0'
+platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
diff --git a/place_tracker/ios/Runner/AppDelegate.m b/place_tracker/ios/Runner/AppDelegate.m
index 59a72e90b..bd40e835e 100644
--- a/place_tracker/ios/Runner/AppDelegate.m
+++ b/place_tracker/ios/Runner/AppDelegate.m
@@ -1,10 +1,12 @@
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
+#import "GoogleMaps/GoogleMaps.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ [GMSServices provideAPIKey:@"YOUR KEY HERE"];
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];
diff --git a/place_tracker/ios/Runner/Info.plist b/place_tracker/ios/Runner/Info.plist
index 5c35fac65..6e4d55a8f 100644
--- a/place_tracker/ios/Runner/Info.plist
+++ b/place_tracker/ios/Runner/Info.plist
@@ -41,5 +41,7 @@
UIViewControllerBasedStatusBarAppearance
+ io.flutter.embedded_views_preview
+
diff --git a/place_tracker/lib/place_details.dart b/place_tracker/lib/place_details.dart
index 7b092dea8..de7bf3edd 100644
--- a/place_tracker/lib/place_details.dart
+++ b/place_tracker/lib/place_details.dart
@@ -25,6 +25,7 @@ class PlaceDetails extends StatefulWidget {
class PlaceDetailsState extends State {
Place _place;
GoogleMapController _mapController;
+ final Set _markers = {};
final TextEditingController _nameController = TextEditingController();
final TextEditingController _descriptionController = TextEditingController();
@@ -39,7 +40,12 @@ class PlaceDetailsState extends State {
void _onMapCreated(GoogleMapController controller) {
_mapController = controller;
- _mapController.addMarker(MarkerOptions(position: _place.latLng));
+ setState(() {
+ _markers.add(Marker(
+ markerId: MarkerId(_place.latLng.toString()),
+ position: _place.latLng,
+ ));
+ });
}
Widget _detailsBody() {
@@ -74,6 +80,7 @@ class PlaceDetailsState extends State {
center: _place.latLng,
mapController: _mapController,
onMapCreated: _onMapCreated,
+ markers: _markers,
),
const _Reviews(),
],
@@ -210,6 +217,7 @@ class _Map extends StatelessWidget {
@required this.center,
@required this.mapController,
@required this.onMapCreated,
+ @required this.markers,
Key key,
}) : assert(center != null),
assert(onMapCreated != null),
@@ -218,6 +226,7 @@ class _Map extends StatelessWidget {
final LatLng center;
final GoogleMapController mapController;
final ArgumentCallback onMapCreated;
+ final Set markers;
@override
Widget build(BuildContext context) {
@@ -229,16 +238,15 @@ class _Map extends StatelessWidget {
height: 240.0,
child: GoogleMap(
onMapCreated: onMapCreated,
- options: GoogleMapOptions(
- cameraPosition: CameraPosition(
- target: center,
- zoom: 16.0,
- ),
- zoomGesturesEnabled: false,
- rotateGesturesEnabled: false,
- tiltGesturesEnabled: false,
- scrollGesturesEnabled: false,
+ initialCameraPosition: CameraPosition(
+ target: center,
+ zoom: 16.0,
),
+ markers: markers,
+ zoomGesturesEnabled: false,
+ rotateGesturesEnabled: false,
+ tiltGesturesEnabled: false,
+ scrollGesturesEnabled: false,
),
),
);
diff --git a/place_tracker/lib/place_map.dart b/place_tracker/lib/place_map.dart
index 5c6db4c5a..12fcaf404 100644
--- a/place_tracker/lib/place_map.dart
+++ b/place_tracker/lib/place_map.dart
@@ -41,49 +41,55 @@ class PlaceMapState extends State {
return places.where((Place place) => place.category == category).toList();
}
- GoogleMapController mapController;
+ Completer mapController = Completer();
+
+ MapType _currentMapType = MapType.normal;
+
+ LatLng _lastMapPosition;
+
Map _markedPlaces = Map();
+
+ final Set _markers = {};
+
Marker _pendingMarker;
+
MapConfiguration _configuration;
void onMapCreated(GoogleMapController controller) async {
- mapController = controller;
- mapController.onInfoWindowTapped.add(_onInfoWindowTapped);
+ mapController.complete(controller);
+ _lastMapPosition = widget.center;
// Draw initial place markers on creation so that we have something
// interesting to look at.
- final Map places = await _markPlaces();
- _zoomToFitPlaces(
+ setState(() {
+ for (Place place in AppState.of(context).places) {
+ _markers.add(_createPlaceMarker(place));
+ }
+ });
+
+ // Zoom to fit the initially selected category.
+ await _zoomToFitPlaces(
_getPlacesForCategory(
AppState.of(context).selectedCategory,
- places.values.toList(),
+ _markedPlaces.values.toList(),
),
);
}
- Future