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() { | |
setState(() { | |
_markers.add(Marker( | |
// This marker id can be anything that uniquely identifies each marker. | |
markerId: MarkerId(_lastMapPosition.toString()), | |
position: _lastMapPosition, | |
infoWindow: InfoWindow( | |
title: 'Really cool place', | |
snippet: '5 Star Rating', | |
), |
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
LatLng _lastMapPosition = _center; | |
void _onCameraMove(CameraPosition position) { | |
_lastMapPosition = position.target; | |
} | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
... |
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; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
... | |
GoogleMap( | |
... | |
mapType: _currentMapType, | |
), |
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
<manifest ... | |
<application ... | |
<meta-data android:name="com.google.android.geo.API_KEY" | |
android:value="YOUR ANDROID API 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
dependencies: | |
... | |
google_maps_flutter: ^0.4.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
#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
#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
void _onMapTypeButtonPressed() { | |
setState(() { | |
_currentMapType = _currentMapType == MapType.normal | |
? MapType.satellite | |
: MapType.normal; | |
}); | |
} |
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, | |
initialCameraPosition: CameraPosition( | |
target: _center, | |
zoom: 11.0, | |
), | |
), | |
Padding( |