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 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 / 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 / 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 / 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
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 / Info.plist
Last active December 17, 2018 16:09
maps sample - info.plist
<key>io.flutter.embedded_views_preview</key>
<true/>
@kenzieschmoll
kenzieschmoll / Info.plist
Last active December 17, 2018 16:15
maps sample - final Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
@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
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
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();
}