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
7 changes: 6 additions & 1 deletion packages/google_maps_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
## 0.1.5

* Update the example app (`9990a4b1d72158a14924d712e89d4efef3f178d2`).
* Minor cleanups.

## 0.1.4

* Change dependency from webview_flutter_tizen to webview_flutter_lwe.
* Fix integration test failures
* Fix integration test failures.

## 0.1.3

Expand Down
2 changes: 1 addition & 1 deletion packages/google_maps_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This package is not an _endorsed_ implementation of `google_maps_flutter`. There
```yaml
dependencies:
google_maps_flutter: ^2.1.7
google_maps_flutter_tizen: ^0.1.3
google_maps_flutter_tizen: ^0.1.5
```

For detailed usage, see https://pub.dev/packages/google_maps_flutter#sample-usage.
Expand Down
2 changes: 1 addition & 1 deletion packages/google_maps_flutter/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Demonstrates how to use the google_maps_flutter_tizen plugin.

## Getting Started

To run this app on your Tizen device, use [flutter-tizen](https://github.com/flutter-tizen/flutter-tizen).
To run this app on your Tizen device, use [flutter-tizen](https://github.com/flutter-tizen/flutter-tizen).
13 changes: 11 additions & 2 deletions packages/google_maps_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// ignore_for_file: public_member_api_docs

import 'package:flutter/material.dart';

import 'animate_camera.dart';
import 'lite_mode.dart';
import 'map_click.dart';
import 'map_coordinates.dart';
import 'map_ui.dart';
import 'marker_icons.dart';
import 'move_camera.dart';
import 'padding.dart';
import 'page.dart';
import 'place_circle.dart';
import 'place_marker.dart';
import 'place_polygon.dart';
import 'place_polyline.dart';
import 'scrolling_map.dart';
import 'snapshot.dart';
import 'tile_overlay.dart';

final List<GoogleMapExampleAppPage> _allPages = <GoogleMapExampleAppPage>[
const MapUiPage(),
Expand All @@ -25,9 +29,14 @@ final List<GoogleMapExampleAppPage> _allPages = <GoogleMapExampleAppPage>[
const MoveCameraPage(),
const PlaceMarkerPage(),
const MarkerIconsPage(),
const ScrollingMapPage(),
const PlacePolylinePage(),
const PlacePolygonPage(),
const PlaceCirclePage(),
const PaddingPage(),
const SnapshotPage(),
const LiteModePage(),
const TileOverlayPage(),
];

/// MapsDemo is the Main Application.
Expand Down
6 changes: 5 additions & 1 deletion packages/google_maps_flutter/example/lib/map_click.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ class _MapClickBodyState extends State<_MapClickBody> {
lastLongPress,
textAlign: TextAlign.center,
)));
columnChildren.add(Center(
child: Text(
_lastLongPress != null ? 'Long pressed' : '',
textAlign: TextAlign.center,
)));
}

return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: columnChildren,
Expand Down
73 changes: 37 additions & 36 deletions packages/google_maps_flutter/example/lib/map_coordinates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,42 @@ class _MapCoordinatesBodyState extends State<_MapCoordinatesBody> {
final GoogleMap googleMap = GoogleMap(
onMapCreated: onMapCreated,
initialCameraPosition: _kInitialPosition,
onCameraIdle:
_updateVisibleRegion, // https://github.com/flutter/flutter/issues/54758
);

final List<Widget> columnChildren = <Widget>[
Padding(
padding: const EdgeInsets.all(10.0),
child: Center(
child: SizedBox(
width: 300.0,
height: 200.0,
child: googleMap,
return NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification scrollState) {
_updateVisibleRegion();
return true;
},
child: ListView(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(10.0),
child: Center(
child: SizedBox(
width: 300.0,
height: 200.0,
child: googleMap,
),
),
),
),
if (mapController != null)
Center(
child: Text('VisibleRegion:'
'\nnortheast: ${_visibleRegion.northeast},'
'\nsouthwest: ${_visibleRegion.southwest}'),
),
// Add a block at the bottom of this list to allow validation that the visible region of the map
// does not change when scrolled under the safe view on iOS.
// https://github.com/flutter/flutter/issues/107913
Container(
width: 300,
height: 1000,
),
],
),
];

if (mapController != null) {
final String currentVisibleRegion = 'VisibleRegion:'
'\nnortheast: ${_visibleRegion.northeast},'
'\nsouthwest: ${_visibleRegion.southwest}';
columnChildren.add(Center(child: Text(currentVisibleRegion)));
columnChildren.add(_getVisibleRegionButton());
}

return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: columnChildren,
);
}

Expand All @@ -79,19 +89,10 @@ class _MapCoordinatesBodyState extends State<_MapCoordinatesBody> {
});
}

Widget _getVisibleRegionButton() {
return Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
child: const Text('Get Visible Region Bounds'),
onPressed: () async {
final LatLngBounds visibleRegion =
await mapController!.getVisibleRegion();
setState(() {
_visibleRegion = visibleRegion;
});
},
),
);
Future<void> _updateVisibleRegion() async {
final LatLngBounds visibleRegion = await mapController!.getVisibleRegion();
setState(() {
_visibleRegion = visibleRegion;
});
}
}
102 changes: 94 additions & 8 deletions packages/google_maps_flutter/example/lib/map_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ class MapUiBodyState extends State<MapUiBody> {
CameraPosition _position = _kInitialPosition;
bool _isMapCreated = false;
final bool _isMoving = false;
final bool _compassEnabled = true;
final bool _mapToolbarEnabled = true;
bool _compassEnabled = true;
bool _mapToolbarEnabled = true;
CameraTargetBounds _cameraTargetBounds = CameraTargetBounds.unbounded;
MinMaxZoomPreference _minMaxZoomPreference = MinMaxZoomPreference.unbounded;
MapType _mapType = MapType.normal;
final bool _rotateGesturesEnabled = true;
bool _rotateGesturesEnabled = true;
bool _scrollGesturesEnabled = true;
final bool _tiltGesturesEnabled = true;
bool _tiltGesturesEnabled = true;
bool _zoomControlsEnabled = false;
bool _zoomGesturesEnabled = true;
final bool _indoorViewEnabled = true;
final bool _myLocationEnabled = true;
bool _indoorViewEnabled = true;
bool _myLocationEnabled = true;
bool _myTrafficEnabled = false;
final bool _myLocationButtonEnabled = true;
bool _myLocationButtonEnabled = true;
late GoogleMapController _controller;
bool _nightMode = false;

Expand All @@ -70,6 +70,28 @@ class MapUiBodyState extends State<MapUiBody> {
super.dispose();
}

Widget _compassToggler() {
return TextButton(
child: Text('${_compassEnabled ? 'disable' : 'enable'} compass'),
onPressed: () {
setState(() {
_compassEnabled = !_compassEnabled;
});
},
);
}

Widget _mapToolbarToggler() {
return TextButton(
child: Text('${_mapToolbarEnabled ? 'disable' : 'enable'} map toolbar'),
onPressed: () {
setState(() {
_mapToolbarEnabled = !_mapToolbarEnabled;
});
},
);
}

Widget _latLngBoundsToggler() {
return TextButton(
child: Text(
Expand Down Expand Up @@ -115,6 +137,17 @@ class MapUiBodyState extends State<MapUiBody> {
);
}

Widget _rotateToggler() {
return TextButton(
child: Text('${_rotateGesturesEnabled ? 'disable' : 'enable'} rotate'),
onPressed: () {
setState(() {
_rotateGesturesEnabled = !_rotateGesturesEnabled;
});
},
);
}

Widget _scrollToggler() {
return TextButton(
child: Text('${_scrollGesturesEnabled ? 'disable' : 'enable'} scroll'),
Expand All @@ -126,6 +159,17 @@ class MapUiBodyState extends State<MapUiBody> {
);
}

Widget _tiltToggler() {
return TextButton(
child: Text('${_tiltGesturesEnabled ? 'disable' : 'enable'} tilt'),
onPressed: () {
setState(() {
_tiltGesturesEnabled = !_tiltGesturesEnabled;
});
},
);
}

Widget _zoomToggler() {
return TextButton(
child: Text('${_zoomGesturesEnabled ? 'disable' : 'enable'} zoom'),
Expand All @@ -149,6 +193,41 @@ class MapUiBodyState extends State<MapUiBody> {
);
}

Widget _indoorViewToggler() {
return TextButton(
child: Text('${_indoorViewEnabled ? 'disable' : 'enable'} indoor'),
onPressed: () {
setState(() {
_indoorViewEnabled = !_indoorViewEnabled;
});
},
);
}

Widget _myLocationToggler() {
return TextButton(
child: Text(
'${_myLocationEnabled ? 'disable' : 'enable'} my location marker'),
onPressed: () {
setState(() {
_myLocationEnabled = !_myLocationEnabled;
});
},
);
}

Widget _myLocationButtonToggler() {
return TextButton(
child: Text(
'${_myLocationButtonEnabled ? 'disable' : 'enable'} my location button'),
onPressed: () {
setState(() {
_myLocationButtonEnabled = !_myLocationButtonEnabled;
});
},
);
}

Widget _myTrafficToggler() {
return TextButton(
child: Text('${_myTrafficEnabled ? 'disable' : 'enable'} my traffic'),
Expand All @@ -161,7 +240,7 @@ class MapUiBodyState extends State<MapUiBody> {
}

Future<String> _getFileData(String path) async {
return await rootBundle.loadString(path);
return rootBundle.loadString(path);
}

void _setMapStyle(String mapStyle) {
Expand Down Expand Up @@ -236,12 +315,19 @@ class MapUiBodyState extends State<MapUiBody> {
Text('camera zoom: ${_position.zoom}'),
Text('camera tilt: ${_position.tilt}'),
Text(_isMoving ? '(Camera moving)' : '(Camera idle)'),
_compassToggler(),
_mapToolbarToggler(),
_latLngBoundsToggler(),
_mapTypeCycler(),
_zoomBoundsToggler(),
_rotateToggler(),
_scrollToggler(),
_tiltToggler(),
_zoomToggler(),
_zoomControlsToggler(),
_indoorViewToggler(),
_myLocationToggler(),
_myLocationButtonToggler(),
_myTrafficToggler(),
_nightModeToggler(),
],
Expand Down
Loading