diff --git a/lib/widgets/common/map/leaflet/map.dart b/lib/widgets/common/map/leaflet/map.dart index de5e61e55..7f2b14722 100644 --- a/lib/widgets/common/map/leaflet/map.dart +++ b/lib/widgets/common/map/leaflet/map.dart @@ -153,6 +153,8 @@ class _EntryLeafletMapState extends State with TickerProviderSt zoom: bounds.zoom, minZoom: widget.minZoom, maxZoom: widget.maxZoom, + // TODO TLAD [map] as of flutter_map v0.14.0, `doubleTapZoom` does not move when zoom is already maximal + // this could be worked around with https://github.com/fleaflet/flutter_map/pull/960 interactiveFlags: interactive ? InteractiveFlag.all : InteractiveFlag.none, onTap: (tapPosition, point) => widget.onMapTap?.call(), controller: _leafletMapController, diff --git a/lib/widgets/map/map_info_row.dart b/lib/widgets/map/map_info_row.dart index df3db6a36..d3923a454 100644 --- a/lib/widgets/map/map_info_row.dart +++ b/lib/widgets/map/map_info_row.dart @@ -83,16 +83,17 @@ class _AddressRow extends StatefulWidget { class _AddressRowState extends State<_AddressRow> { final ValueNotifier _addressLineNotifier = ValueNotifier(null); + @override + void initState() { + super.initState(); + _updateAddress(); + } + @override void didUpdateWidget(covariant _AddressRow oldWidget) { super.didUpdateWidget(oldWidget); - final entry = widget.entry; - if (oldWidget.entry != entry) { - _getAddressLine(entry).then((addressLine) { - if (mounted && entry == widget.entry) { - _addressLineNotifier.value = addressLine; - } - }); + if (oldWidget.entry != widget.entry) { + _updateAddress(); } } @@ -136,6 +137,14 @@ class _AddressRowState extends State<_AddressRow> { ); } + Future _updateAddress() async { + final entry = widget.entry; + final addressLine = await _getAddressLine(entry); + if (mounted && entry == widget.entry) { + _addressLineNotifier.value = addressLine; + } + } + Future _getAddressLine(AvesEntry? entry) async { if (entry != null && await availability.canLocatePlaces) { final addresses = await GeocodingService.getAddress(entry.latLng!, entry.geocoderLocale);