import 'package:anyway/structs/landmark.dart'; import 'package:flutter/material.dart'; import 'package:map_launcher/map_launcher.dart'; import 'package:flutter_svg/flutter_svg.dart'; showMapChooser(BuildContext context, Landmark current, Landmark next) async { List availableMaps = []; try { availableMaps = await MapLauncher.installedMaps; } catch (e) { print(e); } if (availableMaps.isEmpty) { return; } showModalBottomSheet( context: context, builder: (BuildContext context) { return SafeArea( child: SingleChildScrollView( child: Container( child: Wrap( children: [ for (var map in availableMaps) ListTile( onTap: () => map.showDirections( origin: Coords(current.location[0], current.location[1]), originTitle: current.name, destination: Coords(next.location[0], next.location[1]), destinationTitle: current.name, directionsMode: DirectionsMode.walking ), title: Text(map.mapName), // rounded corners leading: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: SvgPicture.asset( map.icon, height: 30.0, width: 30.0, ), ) ), ], ), ), ), ); }, ); }