Skip to content

Instantly share code, notes, and snippets.

Kenzie Schmoll kenzieschmoll

  • Google
  • Portland, OR
View GitHub Profile
@kenzieschmoll
kenzieschmoll / main.dart
Created Mar 15, 2019
Maps Sample V2 - add onAddmarkerButtonPressed() pt 3 - implement method
View main.dart
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 Mar 15, 2019
Maps Sample V2 - add onAddmarkerButtonPressed() pt 2 - track camera position
View main.dart
LatLng _lastMapPosition = _center;
void _onCameraMove(CameraPosition position) {
_lastMapPosition = position.target;
}
@override
Widget build(BuildContext context) {
return MaterialApp(
...
@kenzieschmoll
kenzieschmoll / main.dart
Last active Mar 15, 2019
Maps Sample V2 - add onAddmarkerButtonPressed() pt 1.
View main.dart
final Set<Marker> _markers = {};
@override
Widget build(BuildContext context) {
return MaterialApp(
...
GoogleMap(
...
markers: _markers,
),
@kenzieschmoll
kenzieschmoll / AppDelegate.m
Created Mar 15, 2019
Maps Sample V2 - AppDelegate.m
View 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 Mar 15, 2019
Maps Sample V2 - android manifest
View AndroidManifest.xml
<manifest ...
<application ...
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="YOUR ANDROID API KEY HERE"/>
@kenzieschmoll
kenzieschmoll / main.dart
Last active Mar 15, 2019
Maps Sample V2 - final main.dart code
View main.dart
import 'dart:async';
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 Feb 28, 2019
Maps Sample V2 - change map appearance pt 2
View main.dart
void _onMapTypeButtonPressed() {
setState(() {
_currentMapType = _currentMapType == MapType.normal
? MapType.satellite
: MapType.normal;
});
}
@kenzieschmoll
kenzieschmoll / main.dart
Last active Mar 15, 2019
Maps Sample V2 - change the map appearance pt 1
View main.dart
MapType _currentMapType = MapType.normal;
@override
Widget build(BuildContext context) {
return MaterialApp(
...
GoogleMap(
...
mapType: _currentMapType,
),
@kenzieschmoll
kenzieschmoll / main.dart
Created Feb 28, 2019
Maps Sample V2 - add widget on top of map
View main.dart
body: Stack(
children: <Widget>[
GoogleMap(
onMapCreated: _onMapCreated,
initialCameraPosition: CameraPosition(
target: _center,
zoom: 11.0,
),
),
Padding(
@kenzieschmoll
kenzieschmoll / main.dart
Last active Mar 15, 2019
Maps Sample V2 - main.dart full screen map
View main.dart
import 'dart:async';
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();
You can’t perform that action at this time.