Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/google_maps_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.1.2

* Fix variouse bugs.
* Update webview_flutter to 3.0.4.
* Update webview_flutter_tizen to 0.5.1.

## 0.1.1

* Update webview_flutter_tizen to 0.3.8.
Expand Down
4 changes: 2 additions & 2 deletions packages/google_maps_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ This package is not an _endorsed_ implementation of `google_maps_flutter`. There

```yaml
dependencies:
google_maps_flutter: ^2.0.8
google_maps_flutter_tizen: ^0.1.1
google_maps_flutter: ^2.1.7
google_maps_flutter_tizen: ^0.1.2
```

In addition, you need a Maps JavaScript API Key to use this plugin. Please refer to the site below to get the API key.
Expand Down
1 change: 0 additions & 1 deletion packages/google_maps_flutter/analysis_options.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import 'dart:async';

import 'package:integration_test/integration_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_flutter_tizen/google_maps_flutter_tizen.dart';
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
import 'package:google_maps_flutter_tizen/google_maps_flutter_tizen.dart';
import 'package:integration_test/integration_test.dart';

const LatLng _kInitialMapCenter = LatLng(0, 0);
const double _kInitialZoomLevel = 5;
Expand All @@ -33,14 +33,17 @@ void main() {
key: key,
initialCameraPosition: _kInitialCameraPosition,
minMaxZoomPreference: initialZoomLevel,
onMapCreated: (GoogleMapController c) async {
onMapCreated: (GoogleMapController c) {
mapId = c.mapId;
},
),
));

await tester.pumpAndSettle();
await tester.pumpAndSettle(const Duration(seconds: 3));

plugin = GoogleMapsFlutterPlatform.instance as GoogleMapsPlugin;
GoogleMapsController? map = plugin.debugGetMapById(mapId);
final GoogleMapsController? map = plugin.debugGetMapById(mapId);
expect(map, isNotNull);

MinMaxZoomPreference zoomLevel = await map!.getMinMaxZoomLevels();
Expand All @@ -53,7 +56,7 @@ void main() {
initialCameraPosition: _kInitialCameraPosition,
minMaxZoomPreference: finalZoomLevel,
onMapCreated: (GoogleMapController controller) {
fail("OnMapCreated should get called only once.");
fail('OnMapCreated should get called only once.');
},
),
));
Expand All @@ -79,8 +82,11 @@ void main() {
),
));

await tester.pumpAndSettle();
await tester.pumpAndSettle(const Duration(seconds: 3));

plugin = GoogleMapsFlutterPlatform.instance as GoogleMapsPlugin;
GoogleMapsController? map = plugin.debugGetMapById(mapId);
final GoogleMapsController? map = plugin.debugGetMapById(mapId);
expect(map, isNotNull);

bool? zoomGesturesEnabled = await map!.isZoomGesturesEnabled();
Expand All @@ -93,7 +99,7 @@ void main() {
initialCameraPosition: _kInitialCameraPosition,
zoomGesturesEnabled: true,
onMapCreated: (GoogleMapController controller) {
fail("OnMapCreated should get called only once.");
fail('OnMapCreated should get called only once.');
},
),
));
Expand All @@ -118,8 +124,11 @@ void main() {
),
));

await tester.pumpAndSettle();
await tester.pumpAndSettle(const Duration(seconds: 2));

plugin = GoogleMapsFlutterPlatform.instance as GoogleMapsPlugin;
GoogleMapsController? map = plugin.debugGetMapById(mapId);
final GoogleMapsController? map = plugin.debugGetMapById(mapId);
expect(map, isNotNull);

bool? zoomControlsEnabled = await map!.isZoomControlsEnabled();
Expand All @@ -132,7 +141,7 @@ void main() {
initialCameraPosition: _kInitialCameraPosition,
zoomControlsEnabled: false,
onMapCreated: (GoogleMapController controller) {
fail("OnMapCreated should get called only once.");
fail('OnMapCreated should get called only once.');
},
),
));
Expand All @@ -158,6 +167,9 @@ void main() {
),
));

await tester.pumpAndSettle();
await tester.pumpAndSettle(const Duration(seconds: 3));

plugin = GoogleMapsFlutterPlatform.instance as GoogleMapsPlugin;
final GoogleMapsController? map = plugin.debugGetMapById(mapId);
expect(map, isNotNull);
Expand Down Expand Up @@ -206,11 +218,11 @@ void main() {
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
// in `mapRendered`.
// https://github.com/flutter/flutter/issues/54758
await Future<void>.delayed(Duration(seconds: 1));
await Future<void>.delayed(const Duration(seconds: 1));

ScreenCoordinate coordinate =
final ScreenCoordinate coordinate =
await mapController.getScreenCoordinate(_kInitialCameraPosition.target);
Rect rect = tester.getRect(find.byKey(key));
final Rect rect = tester.getRect(find.byKey(key));

// On Tizen, the coordinate value from the GoogleMapSdk doesn't include the devicePixelRatio`.
// So we don't need to do the conversion like we did below for other platforms.
Expand Down Expand Up @@ -272,7 +284,7 @@ void main() {

// TODO(iskakaushik): non-zero padding is needed for some device configurations
// https://github.com/flutter/flutter/issues/30575
final double padding = 0;
const double padding = 0;
await mapController
.moveCamera(CameraUpdate.newLatLngBounds(latLngBounds, padding));
// await tester.pumpAndSettle(const Duration(seconds: 3));
Expand Down Expand Up @@ -306,8 +318,11 @@ void main() {
),
));

await tester.pumpAndSettle();
await tester.pumpAndSettle(const Duration(seconds: 3));

plugin = GoogleMapsFlutterPlatform.instance as GoogleMapsPlugin;
GoogleMapsController? map = plugin.debugGetMapById(mapId);
final GoogleMapsController? map = plugin.debugGetMapById(mapId);
expect(map, isNotNull);

bool? isTrafficEnabled = await map!.isTrafficEnabled();
Expand All @@ -320,7 +335,7 @@ void main() {
initialCameraPosition: _kInitialCameraPosition,
trafficEnabled: false,
onMapCreated: (GoogleMapController controller) {
fail("OnMapCreated should get called only once.");
fail('OnMapCreated should get called only once.');
},
),
));
Expand Down Expand Up @@ -420,7 +435,7 @@ void main() {
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
// in `mapRendered`.
// https://github.com/flutter/flutter/issues/54758
await Future<void>.delayed(Duration(seconds: 3));
await Future<void>.delayed(const Duration(seconds: 3));

final LatLngBounds visibleRegion = await controller.getVisibleRegion();
final LatLng topLeft =
Expand Down Expand Up @@ -455,7 +470,7 @@ void main() {
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
// in `mapRendered`.
// https://github.com/flutter/flutter/issues/54758
await Future<void>.delayed(Duration(seconds: 3));
await Future<void>.delayed(const Duration(seconds: 3));

double zoom = await controller.getZoomLevel();
expect(zoom, _kInitialZoomLevel);
Expand Down Expand Up @@ -487,7 +502,7 @@ void main() {
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
// in `mapRendered`.
// https://github.com/flutter/flutter/issues/54758
await Future<void>.delayed(Duration(seconds: 3));
await Future<void>.delayed(const Duration(seconds: 3));

final LatLngBounds visibleRegion = await controller.getVisibleRegion();
final LatLng northWest = LatLng(
Expand Down Expand Up @@ -525,7 +540,7 @@ void main() {
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
// in `mapRendered`.
// https://github.com/flutter/flutter/issues/54758
await Future<void>.delayed(Duration(seconds: 3));
await Future<void>.delayed(const Duration(seconds: 3));

// Simple call to make sure that the app hasn't crashed.
final LatLngBounds bounds1 = await controller.getVisibleRegion();
Expand All @@ -539,7 +554,7 @@ void main() {
infoWindow: InfoWindow(title: 'InfoWindow'));
final Set<Marker> markers = <Marker>{marker};

Completer<GoogleMapController> controllerCompleter =
final Completer<GoogleMapController> controllerCompleter =
Completer<GoogleMapController>();

await tester.pumpWidget(Directionality(
Expand Down Expand Up @@ -568,9 +583,9 @@ void main() {
expect(iwVisibleStatus, false);
});

testWidgets("fromAssetImage", (WidgetTester tester) async {
double pixelRatio = 2;
final ImageConfiguration imageConfiguration =
testWidgets('fromAssetImage', (WidgetTester tester) async {
const double pixelRatio = 2;
const ImageConfiguration imageConfiguration =
ImageConfiguration(devicePixelRatio: pixelRatio);
final BitmapDescriptor mip = await BitmapDescriptor.fromAssetImage(
imageConfiguration, 'red_square.png');
Expand Down
7 changes: 4 additions & 3 deletions packages/google_maps_flutter/example/lib/animate_camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'page.dart';

class AnimateCameraPage extends GoogleMapExampleAppPage {
AnimateCameraPage()
: super(const Icon(Icons.map), 'Camera control, animated');
const AnimateCameraPage({Key? key})
: super(const Icon(Icons.map), 'Camera control, animated', key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -20,14 +20,15 @@ class AnimateCameraPage extends GoogleMapExampleAppPage {
}

class AnimateCamera extends StatefulWidget {
const AnimateCamera();
const AnimateCamera({Key? key}) : super(key: key);
@override
State createState() => AnimateCameraState();
}

class AnimateCameraState extends State<AnimateCamera> {
GoogleMapController? mapController;

// ignore: use_setters_to_change_properties
void _onMapCreated(GoogleMapController controller) {
mapController = controller;
}
Expand Down
7 changes: 4 additions & 3 deletions packages/google_maps_flutter/example/lib/lite_mode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const CameraPosition _kInitialPosition =
CameraPosition(target: LatLng(-33.852, 151.211), zoom: 11.0);

class LiteModePage extends GoogleMapExampleAppPage {
LiteModePage() : super(const Icon(Icons.map), 'Lite mode');
const LiteModePage({Key? key})
: super(const Icon(Icons.map), 'Lite mode', key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -25,9 +26,9 @@ class _LiteModeBody extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Card(
return const Card(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 30.0),
padding: EdgeInsets.symmetric(vertical: 30.0),
child: Center(
child: SizedBox(
width: 300.0,
Expand Down
26 changes: 15 additions & 11 deletions packages/google_maps_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@ import 'place_polygon.dart';
import 'place_polyline.dart';

final List<GoogleMapExampleAppPage> _allPages = <GoogleMapExampleAppPage>[
MapUiPage(),
MapCoordinatesPage(),
MapClickPage(),
AnimateCameraPage(),
MoveCameraPage(),
PlaceMarkerPage(),
MarkerIconsPage(),
PlacePolylinePage(),
PlacePolygonPage(),
PlaceCirclePage(),
const MapUiPage(),
const MapCoordinatesPage(),
const MapClickPage(),
const AnimateCameraPage(),
const MoveCameraPage(),
const PlaceMarkerPage(),
const MarkerIconsPage(),
const PlacePolylinePage(),
const PlacePolygonPage(),
const PlaceCirclePage(),
];

/// MapsDemo is the Main Application.
class MapsDemo extends StatelessWidget {
/// Default Constructor
const MapsDemo({Key? key}) : super(key: key);

void _pushPage(BuildContext context, GoogleMapExampleAppPage page) {
Navigator.of(context).push(MaterialPageRoute<void>(
builder: (_) => Scaffold(
Expand All @@ -56,5 +60,5 @@ class MapsDemo extends StatelessWidget {
}

void main() {
runApp(MaterialApp(home: MapsDemo()));
runApp(const MaterialApp(home: MapsDemo()));
}
17 changes: 13 additions & 4 deletions packages/google_maps_flutter/example/lib/map_click.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const CameraPosition _kInitialPosition =
CameraPosition(target: LatLng(-33.852, 151.211), zoom: 11.0);

class MapClickPage extends GoogleMapExampleAppPage {
MapClickPage() : super(const Icon(Icons.mouse), 'Map click');
const MapClickPage({Key? key})
: super(const Icon(Icons.mouse), 'Map click', key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -67,8 +68,16 @@ class _MapClickBodyState extends State<_MapClickBody> {
if (mapController != null) {
final String lastTap = 'Tap:\n${_lastTap ?? ""}\n';
final String lastLongPress = 'Long press:\n${_lastLongPress ?? ""}';
columnChildren
.add(Center(child: Text(lastTap, textAlign: TextAlign.center)));
columnChildren.add(Center(
child: Text(
lastTap,
textAlign: TextAlign.center,
)));
columnChildren.add(Center(
child: Text(
_lastTap != null ? 'Tapped' : '',
textAlign: TextAlign.center,
)));
columnChildren.add(Center(
child: Text(
lastLongPress,
Expand All @@ -83,7 +92,7 @@ class _MapClickBodyState extends State<_MapClickBody> {
);
}

void onMapCreated(GoogleMapController controller) async {
Future<void> onMapCreated(GoogleMapController controller) async {
setState(() {
mapController = controller;
});
Expand Down
5 changes: 3 additions & 2 deletions packages/google_maps_flutter/example/lib/map_coordinates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const CameraPosition _kInitialPosition =
CameraPosition(target: LatLng(-33.852, 151.211), zoom: 11.0);

class MapCoordinatesPage extends GoogleMapExampleAppPage {
MapCoordinatesPage() : super(const Icon(Icons.map), 'Map coordinates');
const MapCoordinatesPage({Key? key})
: super(const Icon(Icons.map), 'Map coordinates', key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -71,7 +72,7 @@ class _MapCoordinatesBodyState extends State<_MapCoordinatesBody> {
);
}

void onMapCreated(GoogleMapController controller) async {
Future<void> onMapCreated(GoogleMapController controller) async {
final LatLngBounds visibleRegion = await controller.getVisibleRegion();
setState(() {
mapController = controller;
Expand Down
Loading