Finish adding the markers to the map view to display info about that specific drop off's tips and base pay.

This commit is contained in:
zontreck 2025-05-15 20:19:35 -07:00
parent a5fa4e0309
commit e94bbaaf91
5 changed files with 50 additions and 4 deletions

View file

@ -1,3 +1,3 @@
{
"alpha": "1.0.0-dev.8"
"alpha": "1.0.0-dev.9"
}

View file

@ -6,12 +6,12 @@ import 'package:geolocator/geolocator.dart';
class TTConsts {
static get UPDATE_URL =>
"https://git.zontreck.com/AriasCreations/TimeTracker/raw/branch/main/latest-releases.json";
static const VERSION = "1.0.0-dev.8";
static const VERSION = "1.0.0-dev.9";
static bool UPDATE_AVAILABLE = false;
static UpdateChannel UPDATE_CHANNEL = UpdateChannel.alpha;
static final LocationSettings LOCATION_SETTINGS = LocationSettings(
accuracy: LocationAccuracy.bestForNavigation,
distanceFilter: 50,
distanceFilter: 15,
);
static Future<void> checkUpdate() async {

View file

@ -125,6 +125,7 @@ class SessionData {
static Trip GetNewTrip({required double basePay}) {
currentTrip = Trip(BasePay: basePay);
Trips.add(currentTrip!);
return currentTrip!;
}

View file

@ -18,10 +18,12 @@ class _MapPage extends State<MapPage> {
MapController controller = MapController();
LatLng initialPosition = LatLng(0, 0);
List<LatLng> PointMap = [];
List<Marker> Markers = [];
@override
void didChangeDependencies() {
PointMap = [];
Markers = [];
var firstPos = SessionData.positions[0];
initialPosition = LatLng(firstPos.latitude, firstPos.longitude);
@ -30,6 +32,48 @@ class _MapPage extends State<MapPage> {
PointMap.add(LatLng(position.latitude, position.longitude));
}
print("Total trips: ${SessionData.Trips.length}");
for (var trip in SessionData.Trips) {
for (var dropOff in trip.deliveries) {
Markers.add(
Marker(
point: LatLng(
dropOff.endLocation!.latitude,
dropOff.endLocation!.longitude,
),
child: Stack(
children: [
IconButton(
onPressed: () {
showDialog(
context: context,
builder: (builder) {
return AlertDialog(
title: Text(
"Trip #${SessionData.Trips.indexOf(trip) + 1}; DropOff #${trip.deliveries.indexOf(dropOff) + 1}",
),
content: Text(
"Pay: \$${trip.BasePay}\nTip: \$${dropOff.TipAmount}",
),
);
},
);
},
icon: Icon(
Icons.location_on_rounded,
size: 24,
color: Colors.red,
),
),
],
),
),
);
print("Marker added");
}
}
setState(() {});
super.didChangeDependencies();
}
@ -83,6 +127,7 @@ class _MapPage extends State<MapPage> {
),
],
),
MarkerLayer(markers: Markers),
RichAttributionWidget(
attributions: [
TextSourceAttribution('OpenStreetMap contributors'),

View file

@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0-dev.8
version: 1.0.0-dev.9
environment:
sdk: ^3.7.2