mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
dart migrate place_tracker (#831)
This commit is contained in:
@@ -2,7 +2,7 @@ PODS:
|
|||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
- google_maps_flutter (0.0.1):
|
- google_maps_flutter (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- GoogleMaps (< 3.10)
|
- GoogleMaps
|
||||||
- GoogleMaps (3.9.0):
|
- GoogleMaps (3.9.0):
|
||||||
- GoogleMaps/Maps (= 3.9.0)
|
- GoogleMaps/Maps (= 3.9.0)
|
||||||
- GoogleMaps/Base (3.9.0)
|
- GoogleMaps/Base (3.9.0)
|
||||||
@@ -25,7 +25,7 @@ EXTERNAL SOURCES:
|
|||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
|
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
|
||||||
google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619
|
google_maps_flutter: df4e7de95264aa0a2f11aac0fc7e313acb8ffc7e
|
||||||
GoogleMaps: 4b5346bddfe6911bb89155d43c903020170523ac
|
GoogleMaps: 4b5346bddfe6911bb89155d43c903020170523ac
|
||||||
|
|
||||||
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
|
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
|
|
||||||
class Place {
|
class Place {
|
||||||
@@ -10,33 +9,29 @@ class Place {
|
|||||||
final LatLng latLng;
|
final LatLng latLng;
|
||||||
final String name;
|
final String name;
|
||||||
final PlaceCategory category;
|
final PlaceCategory category;
|
||||||
final String description;
|
final String? description;
|
||||||
final int starRating;
|
final int starRating;
|
||||||
|
|
||||||
const Place({
|
const Place({
|
||||||
@required this.id,
|
required this.id,
|
||||||
@required this.latLng,
|
required this.latLng,
|
||||||
@required this.name,
|
required this.name,
|
||||||
@required this.category,
|
required this.category,
|
||||||
this.description,
|
this.description,
|
||||||
this.starRating = 0,
|
this.starRating = 0,
|
||||||
}) : assert(id != null),
|
}) : assert(starRating >= 0 && starRating <= 5);
|
||||||
assert(latLng != null),
|
|
||||||
assert(name != null),
|
|
||||||
assert(category != null),
|
|
||||||
assert(starRating != null && starRating >= 0 && starRating <= 5);
|
|
||||||
|
|
||||||
double get latitude => latLng.latitude;
|
double get latitude => latLng.latitude;
|
||||||
|
|
||||||
double get longitude => latLng.longitude;
|
double get longitude => latLng.longitude;
|
||||||
|
|
||||||
Place copyWith({
|
Place copyWith({
|
||||||
String id,
|
String? id,
|
||||||
LatLng latLng,
|
LatLng? latLng,
|
||||||
String name,
|
String? name,
|
||||||
PlaceCategory category,
|
PlaceCategory? category,
|
||||||
String description,
|
String? description,
|
||||||
int starRating,
|
int? starRating,
|
||||||
}) {
|
}) {
|
||||||
return Place(
|
return Place(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
|
|||||||
@@ -15,20 +15,18 @@ class PlaceDetails extends StatefulWidget {
|
|||||||
final ValueChanged<Place> onChanged;
|
final ValueChanged<Place> onChanged;
|
||||||
|
|
||||||
const PlaceDetails({
|
const PlaceDetails({
|
||||||
@required this.place,
|
required this.place,
|
||||||
@required this.onChanged,
|
required this.onChanged,
|
||||||
Key key,
|
Key? key,
|
||||||
}) : assert(place != null),
|
}) : super(key: key);
|
||||||
assert(onChanged != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PlaceDetailsState createState() => PlaceDetailsState();
|
PlaceDetailsState createState() => PlaceDetailsState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class PlaceDetailsState extends State<PlaceDetails> {
|
class PlaceDetailsState extends State<PlaceDetails> {
|
||||||
Place _place;
|
late Place _place;
|
||||||
GoogleMapController _mapController;
|
GoogleMapController? _mapController;
|
||||||
final Set<Marker> _markers = {};
|
final Set<Marker> _markers = {};
|
||||||
final TextEditingController _nameController = TextEditingController();
|
final TextEditingController _nameController = TextEditingController();
|
||||||
final TextEditingController _descriptionController = TextEditingController();
|
final TextEditingController _descriptionController = TextEditingController();
|
||||||
@@ -65,7 +63,7 @@ class PlaceDetailsState extends State<PlaceDetails> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
_place = widget.place;
|
_place = widget.place;
|
||||||
_nameController.text = _place.name;
|
_nameController.text = _place.name;
|
||||||
_descriptionController.text = _place.description;
|
_descriptionController.text = _place.description!;
|
||||||
return super.initState();
|
return super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,12 +122,10 @@ class _DescriptionTextField extends StatelessWidget {
|
|||||||
|
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
const _DescriptionTextField({
|
const _DescriptionTextField({
|
||||||
@required this.controller,
|
required this.controller,
|
||||||
@required this.onChanged,
|
required this.onChanged,
|
||||||
Key key,
|
Key? key,
|
||||||
}) : assert(controller != null),
|
}) : super(key: key);
|
||||||
assert(onChanged != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -155,18 +151,16 @@ class _DescriptionTextField extends StatelessWidget {
|
|||||||
class _Map extends StatelessWidget {
|
class _Map extends StatelessWidget {
|
||||||
final LatLng center;
|
final LatLng center;
|
||||||
|
|
||||||
final GoogleMapController mapController;
|
final GoogleMapController? mapController;
|
||||||
final ArgumentCallback<GoogleMapController> onMapCreated;
|
final ArgumentCallback<GoogleMapController> onMapCreated;
|
||||||
final Set<Marker> markers;
|
final Set<Marker> markers;
|
||||||
const _Map({
|
const _Map({
|
||||||
@required this.center,
|
required this.center,
|
||||||
@required this.mapController,
|
required this.mapController,
|
||||||
@required this.onMapCreated,
|
required this.onMapCreated,
|
||||||
@required this.markers,
|
required this.markers,
|
||||||
Key key,
|
Key? key,
|
||||||
}) : assert(center != null),
|
}) : super(key: key);
|
||||||
assert(onMapCreated != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -198,12 +192,10 @@ class _NameTextField extends StatelessWidget {
|
|||||||
|
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
const _NameTextField({
|
const _NameTextField({
|
||||||
@required this.controller,
|
required this.controller,
|
||||||
@required this.onChanged,
|
required this.onChanged,
|
||||||
Key key,
|
Key? key,
|
||||||
}) : assert(controller != null),
|
}) : super(key: key);
|
||||||
assert(onChanged != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -227,7 +219,7 @@ class _NameTextField extends StatelessWidget {
|
|||||||
|
|
||||||
class _Reviews extends StatelessWidget {
|
class _Reviews extends StatelessWidget {
|
||||||
const _Reviews({
|
const _Reviews({
|
||||||
Key key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -320,11 +312,10 @@ class _StarBar extends StatelessWidget {
|
|||||||
final int rating;
|
final int rating;
|
||||||
final ValueChanged<int> onChanged;
|
final ValueChanged<int> onChanged;
|
||||||
const _StarBar({
|
const _StarBar({
|
||||||
@required this.rating,
|
required this.rating,
|
||||||
@required this.onChanged,
|
required this.onChanged,
|
||||||
Key key,
|
Key? key,
|
||||||
}) : assert(rating != null && rating >= 0 && rating <= maxStars),
|
}) : assert(rating >= 0 && rating <= maxStars),
|
||||||
assert(onChanged != null),
|
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import 'place_details.dart';
|
|||||||
import 'place_tracker_app.dart';
|
import 'place_tracker_app.dart';
|
||||||
|
|
||||||
class PlaceList extends StatefulWidget {
|
class PlaceList extends StatefulWidget {
|
||||||
const PlaceList({Key key}) : super(key: key);
|
const PlaceList({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PlaceListState createState() => PlaceListState();
|
PlaceListState createState() => PlaceListState();
|
||||||
@@ -69,17 +69,15 @@ class _CategoryButton extends StatelessWidget {
|
|||||||
final bool selected;
|
final bool selected;
|
||||||
final ValueChanged<PlaceCategory> onCategoryChanged;
|
final ValueChanged<PlaceCategory> onCategoryChanged;
|
||||||
const _CategoryButton({
|
const _CategoryButton({
|
||||||
Key key,
|
Key? key,
|
||||||
@required this.category,
|
required this.category,
|
||||||
@required this.selected,
|
required this.selected,
|
||||||
@required this.onCategoryChanged,
|
required this.onCategoryChanged,
|
||||||
}) : assert(category != null),
|
}) : super(key: key);
|
||||||
assert(selected != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String _buttonText;
|
late String _buttonText;
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case PlaceCategory.favorite:
|
case PlaceCategory.favorite:
|
||||||
_buttonText = 'Favorites';
|
_buttonText = 'Favorites';
|
||||||
@@ -122,12 +120,10 @@ class _ListCategoryButtonBar extends StatelessWidget {
|
|||||||
|
|
||||||
final ValueChanged<PlaceCategory> onCategoryChanged;
|
final ValueChanged<PlaceCategory> onCategoryChanged;
|
||||||
const _ListCategoryButtonBar({
|
const _ListCategoryButtonBar({
|
||||||
Key key,
|
Key? key,
|
||||||
@required this.selectedCategory,
|
required this.selectedCategory,
|
||||||
@required this.onCategoryChanged,
|
required this.onCategoryChanged,
|
||||||
}) : assert(selectedCategory != null),
|
}) : super(key: key);
|
||||||
assert(onCategoryChanged != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -159,12 +155,10 @@ class _PlaceListTile extends StatelessWidget {
|
|||||||
|
|
||||||
final ValueChanged<Place> onPlaceChanged;
|
final ValueChanged<Place> onPlaceChanged;
|
||||||
const _PlaceListTile({
|
const _PlaceListTile({
|
||||||
Key key,
|
Key? key,
|
||||||
@required this.place,
|
required this.place,
|
||||||
@required this.onPlaceChanged,
|
required this.onPlaceChanged,
|
||||||
}) : assert(place != null),
|
}) : super(key: key);
|
||||||
assert(onPlaceChanged != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|||||||
@@ -21,10 +21,9 @@ class MapConfiguration {
|
|||||||
final PlaceCategory selectedCategory;
|
final PlaceCategory selectedCategory;
|
||||||
|
|
||||||
const MapConfiguration({
|
const MapConfiguration({
|
||||||
@required this.places,
|
required this.places,
|
||||||
@required this.selectedCategory,
|
required this.selectedCategory,
|
||||||
}) : assert(places != null),
|
});
|
||||||
assert(selectedCategory != null);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => places.hashCode ^ selectedCategory.hashCode;
|
int get hashCode => places.hashCode ^ selectedCategory.hashCode;
|
||||||
@@ -53,10 +52,10 @@ class MapConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PlaceMap extends StatefulWidget {
|
class PlaceMap extends StatefulWidget {
|
||||||
final LatLng center;
|
final LatLng? center;
|
||||||
|
|
||||||
const PlaceMap({
|
const PlaceMap({
|
||||||
Key key,
|
Key? key,
|
||||||
this.center,
|
this.center,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@@ -69,15 +68,15 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
|
|
||||||
MapType _currentMapType = MapType.normal;
|
MapType _currentMapType = MapType.normal;
|
||||||
|
|
||||||
LatLng _lastMapPosition;
|
LatLng? _lastMapPosition;
|
||||||
|
|
||||||
final Map<Marker, Place> _markedPlaces = <Marker, Place>{};
|
final Map<Marker, Place> _markedPlaces = <Marker, Place>{};
|
||||||
|
|
||||||
final Set<Marker> _markers = {};
|
final Set<Marker> _markers = {};
|
||||||
|
|
||||||
Marker _pendingMarker;
|
Marker? _pendingMarker;
|
||||||
|
|
||||||
MapConfiguration _configuration;
|
MapConfiguration? _configuration;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -95,7 +94,7 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
GoogleMap(
|
GoogleMap(
|
||||||
onMapCreated: onMapCreated,
|
onMapCreated: onMapCreated,
|
||||||
initialCameraPosition: CameraPosition(
|
initialCameraPosition: CameraPosition(
|
||||||
target: widget.center,
|
target: widget.center!,
|
||||||
zoom: 11.0,
|
zoom: 11.0,
|
||||||
),
|
),
|
||||||
mapType: _currentMapType,
|
mapType: _currentMapType,
|
||||||
@@ -173,9 +172,9 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
if (_pendingMarker != null) {
|
if (_pendingMarker != null) {
|
||||||
// Create a new Place and map it to the marker we just added.
|
// Create a new Place and map it to the marker we just added.
|
||||||
final newPlace = Place(
|
final newPlace = Place(
|
||||||
id: Uuid().v1(),
|
id: const Uuid().v1(),
|
||||||
latLng: _pendingMarker.position,
|
latLng: _pendingMarker!.position,
|
||||||
name: _pendingMarker.infoWindow.title,
|
name: _pendingMarker!.infoWindow.title!,
|
||||||
category:
|
category:
|
||||||
Provider.of<AppState>(context, listen: false).selectedCategory,
|
Provider.of<AppState>(context, listen: false).selectedCategory,
|
||||||
);
|
);
|
||||||
@@ -184,7 +183,7 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
Provider.of<AppState>(context, listen: false).selectedCategory);
|
Provider.of<AppState>(context, listen: false).selectedCategory);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
final updatedMarker = _pendingMarker.copyWith(
|
final updatedMarker = _pendingMarker!.copyWith(
|
||||||
iconParam: placeMarker,
|
iconParam: placeMarker,
|
||||||
infoWindowParam: InfoWindow(
|
infoWindowParam: InfoWindow(
|
||||||
title: 'New Place',
|
title: 'New Place',
|
||||||
@@ -263,9 +262,9 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
// changes come from the [place_map], we should only enter this if statement
|
// changes come from the [place_map], we should only enter this if statement
|
||||||
// when returning to the [place_map] after changes have been made from
|
// when returning to the [place_map] after changes have been made from
|
||||||
// [place_list].
|
// [place_list].
|
||||||
if (_configuration != newConfiguration && mapController != null) {
|
if (_configuration != newConfiguration) {
|
||||||
if (_configuration.places == newConfiguration.places &&
|
if (_configuration!.places == newConfiguration.places &&
|
||||||
_configuration.selectedCategory !=
|
_configuration!.selectedCategory !=
|
||||||
newConfiguration.selectedCategory) {
|
newConfiguration.selectedCategory) {
|
||||||
// If the configuration change is only a category change, just update
|
// If the configuration change is only a category change, just update
|
||||||
// the marker visibilities.
|
// the marker visibilities.
|
||||||
@@ -274,7 +273,7 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
// At this point, we know the places have been updated from the list
|
// At this point, we know the places have been updated from the list
|
||||||
// view. We need to reconfigure the map to respect the updates.
|
// view. We need to reconfigure the map to respect the updates.
|
||||||
newConfiguration.places
|
newConfiguration.places
|
||||||
.where((p) => !_configuration.places.contains(p))
|
.where((p) => !_configuration!.places.contains(p))
|
||||||
.map((value) => _updateExistingPlaceMarker(place: value));
|
.map((value) => _updateExistingPlaceMarker(place: value));
|
||||||
|
|
||||||
await _zoomToFitPlaces(
|
await _zoomToFitPlaces(
|
||||||
@@ -292,7 +291,7 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
final newMarker = Marker(
|
final newMarker = Marker(
|
||||||
markerId: MarkerId(_lastMapPosition.toString()),
|
markerId: MarkerId(_lastMapPosition.toString()),
|
||||||
position: _lastMapPosition,
|
position: _lastMapPosition!,
|
||||||
infoWindow: const InfoWindow(title: 'New Place'),
|
infoWindow: const InfoWindow(title: 'New Place'),
|
||||||
draggable: true,
|
draggable: true,
|
||||||
icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueGreen),
|
icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueGreen),
|
||||||
@@ -333,8 +332,6 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _pushPlaceDetailsScreen(Place place) {
|
void _pushPlaceDetailsScreen(Place place) {
|
||||||
assert(place != null);
|
|
||||||
|
|
||||||
Navigator.push<void>(
|
Navigator.push<void>(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
@@ -349,7 +346,7 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
Future<void> _showPlacesForSelectedCategory(PlaceCategory category) async {
|
Future<void> _showPlacesForSelectedCategory(PlaceCategory category) async {
|
||||||
setState(() {
|
setState(() {
|
||||||
for (var marker in List.of(_markedPlaces.keys)) {
|
for (var marker in List.of(_markedPlaces.keys)) {
|
||||||
final place = _markedPlaces[marker];
|
final place = _markedPlaces[marker]!;
|
||||||
final updatedMarker = marker.copyWith(
|
final updatedMarker = marker.copyWith(
|
||||||
visibleParam: place.category == category,
|
visibleParam: place.category == category,
|
||||||
);
|
);
|
||||||
@@ -373,9 +370,9 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
await _showPlacesForSelectedCategory(category);
|
await _showPlacesForSelectedCategory(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateExistingPlaceMarker({@required Place place}) {
|
void _updateExistingPlaceMarker({required Place place}) {
|
||||||
var marker = _markedPlaces.keys
|
var marker = _markedPlaces.keys
|
||||||
.singleWhere((value) => _markedPlaces[value].id == place.id);
|
.singleWhere((value) => _markedPlaces[value]!.id == place.id);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
final updatedMarker = marker.copyWith(
|
final updatedMarker = marker.copyWith(
|
||||||
@@ -390,9 +387,9 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _updateMarker({
|
void _updateMarker({
|
||||||
@required Marker marker,
|
required Marker? marker,
|
||||||
@required Marker updatedMarker,
|
required Marker updatedMarker,
|
||||||
@required Place place,
|
required Place place,
|
||||||
}) {
|
}) {
|
||||||
_markers.remove(marker);
|
_markers.remove(marker);
|
||||||
_markedPlaces.remove(marker);
|
_markedPlaces.remove(marker);
|
||||||
@@ -405,10 +402,10 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
var controller = await mapController.future;
|
var controller = await mapController.future;
|
||||||
|
|
||||||
// Default min/max values to latitude and longitude of center.
|
// Default min/max values to latitude and longitude of center.
|
||||||
var minLat = widget.center.latitude;
|
var minLat = widget.center!.latitude;
|
||||||
var maxLat = widget.center.latitude;
|
var maxLat = widget.center!.latitude;
|
||||||
var minLong = widget.center.longitude;
|
var minLong = widget.center!.longitude;
|
||||||
var maxLong = widget.center.longitude;
|
var maxLong = widget.center!.longitude;
|
||||||
|
|
||||||
for (var place in places) {
|
for (var place in places) {
|
||||||
minLat = min(minLat, place.latitude);
|
minLat = min(minLat, place.latitude);
|
||||||
@@ -435,12 +432,10 @@ class PlaceMapState extends State<PlaceMap> {
|
|||||||
return BitmapDescriptor.fromAssetImage(
|
return BitmapDescriptor.fromAssetImage(
|
||||||
createLocalImageConfiguration(context, size: const Size.square(32)),
|
createLocalImageConfiguration(context, size: const Size.square(32)),
|
||||||
'assets/heart.png');
|
'assets/heart.png');
|
||||||
break;
|
|
||||||
case PlaceCategory.visited:
|
case PlaceCategory.visited:
|
||||||
return BitmapDescriptor.fromAssetImage(
|
return BitmapDescriptor.fromAssetImage(
|
||||||
createLocalImageConfiguration(context, size: const Size.square(32)),
|
createLocalImageConfiguration(context, size: const Size.square(32)),
|
||||||
'assets/visited.png');
|
'assets/visited.png');
|
||||||
break;
|
|
||||||
case PlaceCategory.wantToGo:
|
case PlaceCategory.wantToGo:
|
||||||
default:
|
default:
|
||||||
return BitmapDescriptor.defaultMarker;
|
return BitmapDescriptor.defaultMarker;
|
||||||
@@ -460,14 +455,11 @@ class _AddPlaceButtonBar extends StatelessWidget {
|
|||||||
final VoidCallback onCancelPressed;
|
final VoidCallback onCancelPressed;
|
||||||
|
|
||||||
const _AddPlaceButtonBar({
|
const _AddPlaceButtonBar({
|
||||||
Key key,
|
Key? key,
|
||||||
@required this.visible,
|
required this.visible,
|
||||||
@required this.onSavePressed,
|
required this.onSavePressed,
|
||||||
@required this.onCancelPressed,
|
required this.onCancelPressed,
|
||||||
}) : assert(visible != null),
|
}) : super(key: key);
|
||||||
assert(onSavePressed != null),
|
|
||||||
assert(onCancelPressed != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -508,14 +500,11 @@ class _CategoryButtonBar extends StatelessWidget {
|
|||||||
final ValueChanged<PlaceCategory> onChanged;
|
final ValueChanged<PlaceCategory> onChanged;
|
||||||
|
|
||||||
const _CategoryButtonBar({
|
const _CategoryButtonBar({
|
||||||
Key key,
|
Key? key,
|
||||||
@required this.selectedPlaceCategory,
|
required this.selectedPlaceCategory,
|
||||||
@required this.visible,
|
required this.visible,
|
||||||
@required this.onChanged,
|
required this.onChanged,
|
||||||
}) : assert(selectedPlaceCategory != null),
|
}) : super(key: key);
|
||||||
assert(visible != null),
|
|
||||||
assert(onChanged != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -573,14 +562,11 @@ class _MapFabs extends StatelessWidget {
|
|||||||
final VoidCallback onToggleMapTypePressed;
|
final VoidCallback onToggleMapTypePressed;
|
||||||
|
|
||||||
const _MapFabs({
|
const _MapFabs({
|
||||||
Key key,
|
Key? key,
|
||||||
@required this.visible,
|
required this.visible,
|
||||||
@required this.onAddPlacePressed,
|
required this.onAddPlacePressed,
|
||||||
@required this.onToggleMapTypePressed,
|
required this.onToggleMapTypePressed,
|
||||||
}) : assert(visible != null),
|
}) : super(key: key);
|
||||||
assert(onAddPlacePressed != null),
|
|
||||||
assert(onToggleMapTypePressed != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ enum PlaceTrackerViewType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PlaceTrackerApp extends StatelessWidget {
|
class PlaceTrackerApp extends StatelessWidget {
|
||||||
const PlaceTrackerApp({Key key}) : super(key: key);
|
const PlaceTrackerApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -28,7 +28,7 @@ class PlaceTrackerApp extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PlaceTrackerHomePage extends StatelessWidget {
|
class _PlaceTrackerHomePage extends StatelessWidget {
|
||||||
const _PlaceTrackerHomePage({Key key}) : super(key: key);
|
const _PlaceTrackerHomePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -83,8 +83,7 @@ class AppState extends ChangeNotifier {
|
|||||||
this.places = StubData.places,
|
this.places = StubData.places,
|
||||||
this.selectedCategory = PlaceCategory.favorite,
|
this.selectedCategory = PlaceCategory.favorite,
|
||||||
this.viewType = PlaceTrackerViewType.map,
|
this.viewType = PlaceTrackerViewType.map,
|
||||||
}) : assert(places != null),
|
});
|
||||||
assert(selectedCategory != null);
|
|
||||||
|
|
||||||
List<Place> places;
|
List<Place> places;
|
||||||
PlaceCategory selectedCategory;
|
PlaceCategory selectedCategory;
|
||||||
|
|||||||
@@ -43,27 +43,20 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0"
|
version: "1.15.0"
|
||||||
convert:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: convert
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "2.1.1"
|
|
||||||
crypto:
|
crypto:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: crypto
|
name: crypto
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.5"
|
version: "3.0.1"
|
||||||
csslib:
|
csslib:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: csslib
|
name: csslib
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.16.2"
|
version: "0.17.0"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -96,7 +89,7 @@ packages:
|
|||||||
name: flutter_plugin_android_lifecycle
|
name: flutter_plugin_android_lifecycle
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.11"
|
version: "2.0.2"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -113,35 +106,35 @@ packages:
|
|||||||
name: google_maps
|
name: google_maps
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.4.5"
|
version: "5.1.0"
|
||||||
google_maps_flutter:
|
google_maps_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: google_maps_flutter
|
name: google_maps_flutter
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "2.0.6"
|
||||||
google_maps_flutter_platform_interface:
|
google_maps_flutter_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: google_maps_flutter_platform_interface
|
name: google_maps_flutter_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "2.0.4"
|
||||||
google_maps_flutter_web:
|
google_maps_flutter_web:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: google_maps_flutter_web
|
name: google_maps_flutter_web
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.1"
|
version: "0.3.0+1"
|
||||||
html:
|
html:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: html
|
name: html
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.14.0+4"
|
version: "0.15.0"
|
||||||
js:
|
js:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -155,7 +148,7 @@ packages:
|
|||||||
name: js_wrapping
|
name: js_wrapping
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.0"
|
version: "0.7.0"
|
||||||
lints:
|
lints:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -197,21 +190,21 @@ packages:
|
|||||||
name: plugin_platform_interface
|
name: plugin_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.3"
|
version: "2.0.0"
|
||||||
provider:
|
provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: provider
|
name: provider
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.3.3"
|
version: "5.0.0"
|
||||||
sanitize_html:
|
sanitize_html:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: sanitize_html
|
name: sanitize_html
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.1"
|
version: "2.0.0"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -244,7 +237,7 @@ packages:
|
|||||||
name: stream_transform
|
name: stream_transform
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "2.0.0"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -279,7 +272,7 @@ packages:
|
|||||||
name: uuid
|
name: uuid
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.2"
|
version: "3.0.4"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -289,4 +282,4 @@ packages:
|
|||||||
version: "2.1.0"
|
version: "2.1.0"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.12.0 <3.0.0"
|
dart: ">=2.12.0 <3.0.0"
|
||||||
flutter: ">=1.22.0"
|
flutter: ">=2.0.0"
|
||||||
|
|||||||
@@ -4,17 +4,17 @@ description: A new Flutter project.
|
|||||||
version: 1.0.0+1
|
version: 1.0.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.10.0 <3.0.0"
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
cupertino_icons: ^1.0.0
|
cupertino_icons: ^1.0.0
|
||||||
google_maps_flutter: ^1.0.6
|
google_maps_flutter: ^2.0.6
|
||||||
google_maps_flutter_web: ^0.1.0
|
google_maps_flutter_web: ^0.3.0+1
|
||||||
provider: ^4.0.0
|
provider: ^5.0.0
|
||||||
uuid: ^2.0.4
|
uuid: ^3.0.4
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user