2021-09-28 08:18:14 +02:00
|
|
|
part of google_track_trace;
|
|
|
|
|
2021-09-29 10:07:56 +02:00
|
|
|
class TrackTraceController extends ChangeNotifier {
|
|
|
|
TrackTraceController(Marker start, Marker destination)
|
2021-09-29 12:18:53 +02:00
|
|
|
: _startPosition = start,
|
|
|
|
_destinationPosition = destination;
|
2021-09-28 08:18:14 +02:00
|
|
|
|
2021-09-30 10:09:57 +02:00
|
|
|
GoogleMapController? mapController;
|
|
|
|
Marker _startPosition;
|
|
|
|
Marker _destinationPosition;
|
|
|
|
TrackTraceRoute? _route;
|
|
|
|
|
2021-09-29 10:07:56 +02:00
|
|
|
set start(Marker start) {
|
2021-09-29 12:18:53 +02:00
|
|
|
_startPosition = start;
|
2021-09-29 10:07:56 +02:00
|
|
|
notifyListeners();
|
|
|
|
}
|
2021-09-28 08:18:14 +02:00
|
|
|
|
2021-09-29 10:07:56 +02:00
|
|
|
set end(Marker end) {
|
2021-09-29 12:18:53 +02:00
|
|
|
_destinationPosition = end;
|
2021-09-29 10:07:56 +02:00
|
|
|
notifyListeners();
|
|
|
|
}
|
2021-09-28 08:18:14 +02:00
|
|
|
|
2021-09-29 12:18:53 +02:00
|
|
|
Marker get start => _startPosition;
|
2021-09-28 08:18:14 +02:00
|
|
|
|
2021-09-29 12:18:53 +02:00
|
|
|
Marker get end => _destinationPosition;
|
2021-09-29 10:07:56 +02:00
|
|
|
|
2021-09-29 12:18:53 +02:00
|
|
|
TrackTraceRoute? get route => _route;
|
2021-09-29 10:07:56 +02:00
|
|
|
|
2021-09-29 12:18:53 +02:00
|
|
|
set route(TrackTraceRoute? newRoute) {
|
|
|
|
_route = newRoute;
|
2021-09-29 10:07:56 +02:00
|
|
|
notifyListeners();
|
2021-09-28 08:18:14 +02:00
|
|
|
}
|
|
|
|
|
2021-09-29 13:42:13 +02:00
|
|
|
@override
|
|
|
|
void dispose() {
|
2021-09-30 10:09:57 +02:00
|
|
|
mapController?.dispose();
|
2021-09-29 13:42:13 +02:00
|
|
|
super.dispose();
|
|
|
|
}
|
2021-09-29 12:18:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class TrackTraceRoute {
|
2021-09-30 10:09:57 +02:00
|
|
|
TrackTraceRoute(
|
|
|
|
int durationValue, int distanceValue, List<PointLatLng> lineValue,)
|
|
|
|
: duration = durationValue,
|
|
|
|
distance = distanceValue,
|
|
|
|
line = lineValue;
|
2021-09-29 12:18:53 +02:00
|
|
|
/// route duration in seconds
|
2021-09-30 10:09:57 +02:00
|
|
|
int duration = 0;
|
2021-09-29 12:18:53 +02:00
|
|
|
|
|
|
|
/// route distance in meters
|
2021-09-30 10:09:57 +02:00
|
|
|
int distance = 0;
|
2021-09-29 12:18:53 +02:00
|
|
|
|
|
|
|
/// route edge points
|
2021-09-29 13:42:13 +02:00
|
|
|
final List<PointLatLng> line;
|
2021-09-28 08:18:14 +02:00
|
|
|
}
|