У меня есть приложение, которое считывает данные о парковках с базы данных и показывает некоторые метки на карте. Теперь приложение показывает только метки для парковок, но я также хочу добавить на карту метки с каждой отдельной парковки, сохраненной в подколлекции лотов коллекции Parkings. Как я могу это сделать?
maps.dart:
class StoreMap extends StatelessWidget {
StoreMap({
Key key,
@required this.documents,
@required this.initialPosition,
}) : super(key: key);
final List<DocumentSnapshot> documents;
final LatLng initialPosition;
final Completer<GoogleMapController> _controller = Completer();
static final CameraPosition _initialPosition = CameraPosition(
target: LatLng(45.791789, 24.150390),
zoom: 16,
);
@override
Widget build(BuildContext context) {
return Scaffold(
body: GoogleMap(
mapType: MapType.hybrid,
initialCameraPosition: _initialPosition,
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
},
myLocationEnabled: true,
markers:documents.map((document) => new Marker(
markerId: MarkerId(document.get('name')),
position: LatLng(
document.get('location').latitude,
document.get('location').longitude,
),
onTap: () => _changeMap(LatLng(
document.get('location').latitude,
document.get('location').longitude,
)),
infoWindow: InfoWindow(
title: document.get('name'),
snippet: document.get('numberOfLots')),
icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueViolet)),
)
.toSet()
),
floatingActionButton: FloatingActionButton(
onPressed: _currentLocation,
child: Icon(Icons.location_searching),
backgroundColor: Colors.deepPurple[400],
),
);
}
document.collection (лоты) .get (‘location’). latitude не работает, потому что вы не указали никаких документов после сбора (лотов) — person Andreea Purta schedule 03.09.2020
Запись document.collection (лоты) .document (h6nU1Gyx4Tlb5rpGYi5e) .get (‘location’). Latitude тоже не работает — person Andreea Purta schedule 03.09.2020
