1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Add Google Maps Place Tracker sample app to flutter/samples. (#20)

Sample app that displays places on a map. Add/edit places. Interact with map. Iterations to follow.
This commit is contained in:
Kenzie Schmoll
2018-10-26 13:11:10 -07:00
committed by GitHub
parent 4b4d5fef9c
commit 7ab277fad4
58 changed files with 2069 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
enum PlaceCategory {
favorite,
visited,
wantToGo,
}
class Place {
const Place({
@required this.latLng,
@required this.name,
@required this.category,
this.description,
this.starRating = 0,
}) : assert(latLng != null),
assert(name != null),
assert(category != null),
assert(starRating != null && starRating >= 0 && starRating <= 5);
final LatLng latLng;
final String name;
final PlaceCategory category;
final String description;
final int starRating;
double get latitude => latLng.latitude;
double get longitude => latLng.longitude;
Place copyWith({
LatLng latLng,
String name,
PlaceCategory category,
String description,
int starRating,
}) {
return Place(
latLng: latLng ?? this.latLng,
name: name ?? this.name,
category: category ?? this.category,
description: description ?? this.description,
starRating: starRating ?? this.starRating,
);
}
}