mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Add a list view to the place tracker app. (#30)
* Add list view to place tracker. Note: map in listTile is not WAI in this commit. * Remove map from list tiles. Make list tiles tappable (currently editing a place and saving will do nothing if the details screen is pushed from the list view. * Fix text alignment in list. * Initial implementation of using an InheritedWidget to maintain data between list and map. Map does not update correctly at this point. * Use AppModel.update to set the AppState. Add MapConfiguration class to handle map changes based on AppState. * Don't cache AppState - lookup directly. Extract AppState code into it's own file and add static methods. Address comments from Hans. * Extract generic AppModel code.
This commit is contained in:
@@ -9,16 +9,19 @@ enum PlaceCategory {
|
||||
|
||||
class Place {
|
||||
const Place({
|
||||
@required this.id,
|
||||
@required this.latLng,
|
||||
@required this.name,
|
||||
@required this.category,
|
||||
this.description,
|
||||
this.starRating = 0,
|
||||
}) : assert(latLng != null),
|
||||
}) : assert(id != null),
|
||||
assert(latLng != null),
|
||||
assert(name != null),
|
||||
assert(category != null),
|
||||
assert(starRating != null && starRating >= 0 && starRating <= 5);
|
||||
|
||||
final String id;
|
||||
final LatLng latLng;
|
||||
final String name;
|
||||
final PlaceCategory category;
|
||||
@@ -29,6 +32,7 @@ class Place {
|
||||
double get longitude => latLng.longitude;
|
||||
|
||||
Place copyWith({
|
||||
String id,
|
||||
LatLng latLng,
|
||||
String name,
|
||||
PlaceCategory category,
|
||||
@@ -36,6 +40,7 @@ class Place {
|
||||
int starRating,
|
||||
}) {
|
||||
return Place(
|
||||
id: id ?? this.id,
|
||||
latLng: latLng ?? this.latLng,
|
||||
name: name ?? this.name,
|
||||
category: category ?? this.category,
|
||||
|
||||
Reference in New Issue
Block a user