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:
BIN
place_tracker/assets/heart.png
Normal file
BIN
place_tracker/assets/heart.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
BIN
place_tracker/assets/visited.png
Normal file
BIN
place_tracker/assets/visited.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -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) {
|
||||
|
||||
@@ -22,5 +22,7 @@ dev_dependencies:
|
||||
sdk: flutter
|
||||
|
||||
flutter:
|
||||
assets:
|
||||
- assets/
|
||||
|
||||
uses-material-design: true
|
||||
Reference in New Issue
Block a user