You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.5 KiB
Dart
50 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:map_launcher/map_launcher.dart';
|
|
|
|
class MapsSheet {
|
|
static show({
|
|
@required BuildContext context,
|
|
@required Function(AvailableMap map) onMapTap,
|
|
}) async {
|
|
final availableMaps = await MapLauncher.installedMaps;
|
|
|
|
showModalBottomSheet(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return SafeArea(
|
|
child: Column(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
child: Container(
|
|
child: Wrap(
|
|
children: <Widget>[
|
|
for (var map in availableMaps)
|
|
ListTile(
|
|
onTap: () {
|
|
print('map.mapName = ${map.mapName}');
|
|
// map.mapName = Amap
|
|
Navigator.pop(context);
|
|
onMapTap(map);
|
|
},
|
|
title: Text(map.mapName),
|
|
leading: SvgPicture.asset(
|
|
map.icon,
|
|
height: 30.0,
|
|
width: 30.0,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|