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

Use custom marker icons for Favorite places and Visited places. (#31)

This commit is contained in:
Kenzie Schmoll
2018-11-09 15:32:10 -08:00
committed by GitHub
parent c823766300
commit e59c865884
4 changed files with 5 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -22,20 +22,17 @@ class PlaceMap extends StatefulWidget {
class PlaceMapState extends State<PlaceMap> { class PlaceMapState extends State<PlaceMap> {
static BitmapDescriptor _getPlaceMarkerIcon(PlaceCategory category) { static BitmapDescriptor _getPlaceMarkerIcon(PlaceCategory category) {
// TODO(kenzieschmoll): use custom marker assets.
double markerHue;
switch (category) { switch (category) {
case PlaceCategory.favorite: case PlaceCategory.favorite:
markerHue = BitmapDescriptor.hueRed; return BitmapDescriptor.fromAsset('assets/heart.png');
break; break;
case PlaceCategory.visited: case PlaceCategory.visited:
markerHue = BitmapDescriptor.hueViolet; return BitmapDescriptor.fromAsset('assets/visited.png');
break; break;
case PlaceCategory.wantToGo: case PlaceCategory.wantToGo:
default: default:
markerHue = BitmapDescriptor.hueAzure; return BitmapDescriptor.defaultMarker;
} }
return BitmapDescriptor.defaultMarkerWithHue(markerHue);
} }
static List<Place> _getPlacesForCategory(PlaceCategory category, Map<Marker, Place> places) { static List<Place> _getPlacesForCategory(PlaceCategory category, Map<Marker, Place> places) {

View File

@@ -22,5 +22,7 @@ dev_dependencies:
sdk: flutter sdk: flutter
flutter: flutter:
assets:
- assets/
uses-material-design: true uses-material-design: true