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 / pubspec.yaml
Last active December 3, 2018 17:34
maps_sample - add dep to pubspec.yaml
dependencies:
...
google_maps_flutter: ^0.0.3+3
@kenzieschmoll
kenzieschmoll / AndroidManifest.xml
Last active December 3, 2018 17:34
maps sample - android manifest
<manifest ...
<application ...
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="YOUR KEY HERE"/>
@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 / Info.plist
Last active December 17, 2018 16:09
maps sample - info.plist
<key>io.flutter.embedded_views_preview</key>
<true/>
@kenzieschmoll
kenzieschmoll / main.dart
Last active December 19, 2018 15:54
maps sample - full screen map
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();
}
@kenzieschmoll
kenzieschmoll / main.dart
Created December 3, 2018 17:32
maps sample - add widget on top of map
body: Stack(
children: <Widget>[
GoogleMap(
onMapCreated: _onMapCreated,
options: GoogleMapOptions(
cameraPosition: CameraPosition(
target: _center,
zoom: 11.0,
),
),
@kenzieschmoll
kenzieschmoll / main.dart
Last active December 3, 2018 17:39
maps sample - change the map appearance
MapType _currentMapType = MapType.normal;
void _onMapTypeButtonPressed() {
if (_currentMapType == MapType.normal) {
mapController.updateMapOptions(
GoogleMapOptions(mapType: MapType.satellite),
);
_currentMapType = MapType.satellite;
} else {
mapController.updateMapOptions(
@kenzieschmoll
kenzieschmoll / main.dart
Last active December 19, 2018 16:01
maps sample - add second fab
Align(
alignment: Alignment.topRight,
child: Column(
children: <Widget>[
FloatingActionButton(
...
),
SizedBox(height: 16.0),
FloatingActionButton(
onPressed: _onAddMarkerButtonPressed,
@kenzieschmoll
kenzieschmoll / main.dart
Created December 3, 2018 17:40
maps sample - onAddMarkerButtonPressed
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,
),
@kenzieschmoll
kenzieschmoll / main.dart
Last active December 19, 2018 16:02
maps sample - final main.dart code
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();
}