ran formating

This commit is contained in:
Winston Lowe
2026-02-07 11:07:57 -08:00
parent 978ea4790d
commit d1009d3c20
2 changed files with 50 additions and 33 deletions
+7 -7
View File
@@ -691,20 +691,20 @@ class _SettingsScreenState extends State<SettingsScreen> {
_gpxExport(GpxExport exporter) async {
final l10n = context.l10n;
final result = await exporter.exportGPX();
if(!mounted) return;
if (!mounted) return;
switch (result) {
case gpxExportSuccess:
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(l10n.settings_gpxExportSuccess)));
case gpxExportNoContacts:
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(l10n.settings_gpxExportNoContacts)));
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(l10n.settings_gpxExportNoContacts)),
);
case gpxExportNotAvailable:
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(l10n.settings_gpxExportNotAvailable)));
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(l10n.settings_gpxExportNotAvailable)),
);
case gpxExportFailed:
ScaffoldMessenger.of(
context,
+25 -8
View File
@@ -35,19 +35,29 @@ class GpxExport {
GpxExport(this._connector);
void _addContact(String name, double lat, double lon, String desc, [double? ele]) {
_contacts.add(ContactExport(
void _addContact(
String name,
double lat,
double lon,
String desc, [
double? ele,
]) {
_contacts.add(
ContactExport(
name: name.trim(),
lat: lat,
lon: lon,
desc: desc.trim(),
ele: ele,
));
),
);
}
void addRepeaters() {
final contacts = _connector.contacts;
final repeaters = contacts.where((c) => c.type == advTypeRepeater || c.type == advTypeRoom).toList();
final repeaters = contacts
.where((c) => c.type == advTypeRepeater || c.type == advTypeRoom)
.toList();
for (var repeater in repeaters) {
if (repeater.latitude == null || repeater.longitude == null) {
continue;
@@ -109,19 +119,25 @@ class GpxExport {
time: DateTime.now().toUtc(),
);
gpx.wpts = _contacts.map((c) => Wpt(
gpx.wpts = _contacts
.map(
(c) => Wpt(
lat: c.lat,
lon: c.lon,
ele: c.ele,
name: c.name,
desc: c.desc,
)).toList();
),
)
.toList();
final xml = GpxWriter().asString(gpx, pretty: true);
// 2. Save to file
final dir = await getApplicationDocumentsDirectory();
final timestamp = DateTime.now().toUtc().toIso8601String()
final timestamp = DateTime.now()
.toUtc()
.toIso8601String()
.replaceAll(':', '-')
.replaceAll('.', '-')
.split('T')
@@ -134,7 +150,8 @@ class GpxExport {
// 3. Modern share call (2025+ style)
final result = await SharePlus.instance.share(
ShareParams(
text: 'Repeater locations exported from meshcore-open app as GPX file.',
text:
'Repeater locations exported from meshcore-open app as GPX file.',
subject: 'Meshcore Repeaters GPX Export',
files: [XFile(path)],
// Optional: sharePositionOrigin: ... (if you want iPad popover positioning)