The builder panel now labels its actions, lets the user pick round trip or as-entered with an explanation, and only sends when "Run path trace" is pressed. Hops, mode and the last result are kept in UiViewStateService for the session, so going back no longer clears them and the last result can be reopened without sending again.
32 lines
894 B
Dart
32 lines
894 B
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:latlong2/latlong.dart';
|
|
|
|
import 'contact.dart';
|
|
|
|
/// The map's path-trace builder state: the hops picked so far, the trace
|
|
/// mode and the last result. Held by [UiViewStateService] for the app session
|
|
/// so leaving the map or opening the result doesn't discard it.
|
|
class MapPathTraceDraft {
|
|
bool active = false;
|
|
Uint8List? radioKey;
|
|
final List<int> pathBytes = [];
|
|
final List<int> hopWidths = [];
|
|
final List<Contact> contacts = [];
|
|
final List<LatLng> points = [];
|
|
bool returnPath = true;
|
|
Uint8List? lastResultFrame;
|
|
|
|
bool get hasHops => pathBytes.isNotEmpty;
|
|
|
|
bool belongsTo(Uint8List? selfKey) =>
|
|
radioKey == null || selfKey == null || listEquals(radioKey, selfKey);
|
|
|
|
void clear() {
|
|
pathBytes.clear();
|
|
hopWidths.clear();
|
|
contacts.clear();
|
|
points.clear();
|
|
lastResultFrame = null;
|
|
}
|
|
}
|