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 {
|
|
|
|
late final GoogleMapController _mapController;
|
|
|
|
Marker startPosition;
|
|
|
|
Marker destinationPosition;
|
|
|
|
Marker? currentPosition;
|
2021-09-28 08:18:14 +02:00
|
|
|
|
2021-09-29 10:07:56 +02:00
|
|
|
int durationInSeconds = 0;
|
2021-09-28 08:18:14 +02:00
|
|
|
|
2021-09-29 10:07:56 +02:00
|
|
|
TrackTraceController(Marker start, Marker destination)
|
|
|
|
: startPosition = start,
|
|
|
|
destinationPosition = destination;
|
2021-09-28 08:18:14 +02:00
|
|
|
|
2021-09-29 10:07:56 +02:00
|
|
|
set start(Marker start) {
|
|
|
|
startPosition = start;
|
|
|
|
notifyListeners();
|
|
|
|
}
|
2021-09-28 08:18:14 +02:00
|
|
|
|
2021-09-29 10:07:56 +02:00
|
|
|
set current(Marker? current) {
|
|
|
|
currentPosition = current;
|
|
|
|
notifyListeners();
|
|
|
|
}
|
2021-09-28 08:18:14 +02:00
|
|
|
|
2021-09-29 10:07:56 +02:00
|
|
|
set end(Marker end) {
|
|
|
|
destinationPosition = end;
|
|
|
|
notifyListeners();
|
|
|
|
}
|
2021-09-28 08:18:14 +02:00
|
|
|
|
2021-09-29 10:07:56 +02:00
|
|
|
Marker get start => startPosition;
|
2021-09-28 08:18:14 +02:00
|
|
|
|
2021-09-29 10:07:56 +02:00
|
|
|
Marker? get current => currentPosition;
|
|
|
|
|
|
|
|
Marker get end => destinationPosition;
|
|
|
|
|
|
|
|
set duration(int duration) {
|
|
|
|
durationInSeconds = duration;
|
|
|
|
notifyListeners();
|
2021-09-28 08:18:14 +02:00
|
|
|
}
|
|
|
|
|
2021-09-29 10:07:56 +02:00
|
|
|
int get duration => durationInSeconds;
|
|
|
|
|
|
|
|
set mapController(GoogleMapController controller) {
|
|
|
|
_mapController = controller;
|
2021-09-28 08:18:14 +02:00
|
|
|
}
|
2021-09-29 10:07:56 +02:00
|
|
|
|
|
|
|
GoogleMapController get mapController => _mapController;
|
2021-09-28 08:18:14 +02:00
|
|
|
}
|