1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 22:09:06 +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> {
static BitmapDescriptor _getPlaceMarkerIcon(PlaceCategory category) {
// TODO(kenzieschmoll): use custom marker assets.
double markerHue;
switch (category) {
case PlaceCategory.favorite:
markerHue = BitmapDescriptor.hueRed;
return BitmapDescriptor.fromAsset('assets/heart.png');
break;
case PlaceCategory.visited:
markerHue = BitmapDescriptor.hueViolet;
return BitmapDescriptor.fromAsset('assets/visited.png');
break;
case PlaceCategory.wantToGo:
default:
markerHue = BitmapDescriptor.hueAzure;
return BitmapDescriptor.defaultMarker;
}
return BitmapDescriptor.defaultMarkerWithHue(markerHue);
}
static List<Place> _getPlacesForCategory(PlaceCategory category, Map<Marker, Place> places) {

View File

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