Skip to content

Instantly share code, notes, and snippets.

View kenzieschmoll's full-sized avatar

Kenzie Davisson kenzieschmoll

  • Google
  • Portland, OR
View GitHub Profile
@kenzieschmoll
kenzieschmoll / main.dart
Created March 15, 2019 20:00
Maps Sample V2 - add onAddmarkerButtonPressed() pt 3 - implement method
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',
),
@kenzieschmoll
kenzieschmoll / main.dart
Created March 15, 2019 19:54
Maps Sample V2 - add onAddmarkerButtonPressed() pt 2 - track camera position
LatLng _lastMapPosition = _center;
void _onCameraMove(CameraPosition position) {
_lastMapPosition = position.target;
}
@override
Widget build(BuildContext context) {
return MaterialApp(
...
@kenzieschmoll
kenzieschmoll / main.dart
Last active March 15, 2019 18:52
Maps Sample V2 - change the map appearance pt 1
MapType _currentMapType = MapType.normal;
@override
Widget build(BuildContext context) {
return MaterialApp(
...
GoogleMap(
...
mapType: _currentMapType,
),
@kenzieschmoll
kenzieschmoll / AppDelegate.m
Created March 15, 2019 18:25
Maps Sample V2 - AppDelegate.m
#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.
@kenzieschmoll
kenzieschmoll / AndroidManifest.xml
Created March 15, 2019 18:22
Maps Sample V2 - android manifest
<manifest ...
<application ...
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="YOUR ANDROID API KEY HERE"/>
@kenzieschmoll
kenzieschmoll / pubspec.yaml
Last active March 15, 2019 18:00
Maps Sample v2 - pubspec.yaml
dependencies:
...
google_maps_flutter: ^0.4.0
@kenzieschmoll
kenzieschmoll / AppDelegate.m
Last active February 28, 2019 17:11
maps sample - final AppDelegate.m
#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.
@kenzieschmoll
kenzieschmoll / AppDelegate.m
Last active February 28, 2019 17:10
maps sample - app delegate
#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.
@kenzieschmoll
kenzieschmoll / main.dart
Last active February 28, 2019 01:30
Maps Sample V2 - change map appearance pt 2
void _onMapTypeButtonPressed() {
setState(() {
_currentMapType = _currentMapType == MapType.normal
? MapType.satellite
: MapType.normal;
});
}
@kenzieschmoll
kenzieschmoll / main.dart
Created February 28, 2019 01:14
Maps Sample V2 - add widget on top of map
body: Stack(
children: <Widget>[
GoogleMap(
onMapCreated: _onMapCreated,
initialCameraPosition: CameraPosition(
target: _center,
zoom: 11.0,
),
),
Padding(