| void _selectGraphic(Offset localPosition) async { | |
| final result = await _mapViewController.identifyGraphicsOverlay( | |
| _graphicsOverlay, | |
| screenPoint: localPosition, | |
| tolerance: 22, | |
| ); | |
| if (result.graphics.isEmpty || !mounted) return; | |
| final graphic = result.graphics.first; | |
| if (graphic.geometry != null) { | |
| _mapViewController.setViewpointAnimated( | |
| Viewpoint.fromTargetExtent(_expandedEnvelope(graphic.geometry!)), | |
| duration: 1); | |
| } | |
| final countryBagsProducedDouble = | |
| double.parse(graphic.attributes['coffeeBagsProduced']); | |
| final countryBagsProduced = | |
| _numberFormatter.format(countryBagsProducedDouble); | |
| final countryName = graphic.attributes['countryName']; | |
| _showCustomDialog(countryName, countryBagsProduced); | |
| } |