This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies: | |
... | |
google_maps_flutter: ^0.0.3+3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<manifest ... | |
<application ... | |
<meta-data android:name="com.google.android.geo.API_KEY" | |
android:value="YOUR KEY HERE"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "AppDelegate.h" | |
#include "GeneratedPluginRegistrant.h" | |
// Add the GoogleMaps import. | |
#import "GoogleMaps/GoogleMaps.h" | |
@implementation AppDelegate | |
- (BOOL)application:(UIApplication *)application | |
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// Add the following line with your API key. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<key>io.flutter.embedded_views_preview</key> | |
<true/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:google_maps_flutter/google_maps_flutter.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatefulWidget { | |
@override | |
_MyAppState createState() => _MyAppState(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body: Stack( | |
children: <Widget>[ | |
GoogleMap( | |
onMapCreated: _onMapCreated, | |
options: GoogleMapOptions( | |
cameraPosition: CameraPosition( | |
target: _center, | |
zoom: 11.0, | |
), | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MapType _currentMapType = MapType.normal; | |
void _onMapTypeButtonPressed() { | |
if (_currentMapType == MapType.normal) { | |
mapController.updateMapOptions( | |
GoogleMapOptions(mapType: MapType.satellite), | |
); | |
_currentMapType = MapType.satellite; | |
} else { | |
mapController.updateMapOptions( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Align( | |
alignment: Alignment.topRight, | |
child: Column( | |
children: <Widget>[ | |
FloatingActionButton( | |
... | |
), | |
SizedBox(height: 16.0), | |
FloatingActionButton( | |
onPressed: _onAddMarkerButtonPressed, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void _onAddMarkerButtonPressed() { | |
mapController.addMarker( | |
MarkerOptions( | |
position: LatLng( | |
mapController.cameraPosition.target.latitude, | |
mapController.cameraPosition.target.longitude, | |
), | |
infoWindowText: InfoWindowText('Random Place', '5 Star Rating'), | |
icon: BitmapDescriptor.defaultMarker, | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:google_maps_flutter/google_maps_flutter.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatefulWidget { | |
@override | |
_MyAppState createState() => _MyAppState(); | |
} |
OlderNewer