feat(train): routes out and in as GPX (ADR 0030, D45)

A route's page shares it as GPX 1.1 (Android's share sheet, else saved
where the person chooses): its way a track with elevations, its
waypoints and turns as named points. A GPX file comes in from the Routes
tab or, on Android, opened with Train or shared to it; it is planned
along the paths through its points or kept as drawn, then named and
saved as a new route.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-29 10:44:47 +01:00
commit 5ff9b2e053
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -0,0 +1,31 @@
import 'dart:async';
import 'dart:typed_data';
import 'package:halkyon_train_flutter/src/feature/route/data/route_files.dart';
/// [RouteFiles] in memory: the file [picked] next, files handed over with
/// [open], and the files shared kept in [shared].
class FakeRouteFiles({@override final bool shares = true})
implements RouteFiles {
final _opened = StreamController<OpenedFile>.broadcast();
/// What [pick] gives next; null: the person cancels.
OpenedFile? picked;
final shared = <OpenedFile>[];
/// A file opened with Train or shared to it.
void open(OpenedFile file) => _opened.add(file);
@override
Stream<OpenedFile> get opened => _opened.stream;
@override
Future<OpenedFile?> pick() async => picked;
@override
Future<bool> share({required String name, required Uint8List bytes}) async {
shared.add((name: name, bytes: bytes));
return true;
}
}