navigation intent gets opened correctly
All checks were successful
Build and release APK / Build APK (pull_request) Successful in 5m50s
All checks were successful
Build and release APK / Build APK (pull_request) Successful in 5m50s
This commit is contained in:
52
frontend/lib/modules/map_chooser.dart
Normal file
52
frontend/lib/modules/map_chooser.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
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: <Widget>[
|
||||
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,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user