Make the map path trace builder explicit and keep its state
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.
This commit is contained in:
1 parent
c131f56dae
commit
1e786b24ba
27 files changed
+832
-117
No files matched your search
@@ -0,0 +1,31 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user