Public Access
feat(departures): add direction info to departures
This commit is contained in:
@@ -222,7 +222,11 @@ class ApiHandler {
|
|||||||
(x) => Departure.fromJson(
|
(x) => Departure.fromJson(
|
||||||
// needed because I'm too lazy to write a second mostly identical
|
// needed because I'm too lazy to write a second mostly identical
|
||||||
// constructor and a wrapper
|
// constructor and a wrapper
|
||||||
_expandDeparturesJson(httpPackageJson, x, ["ref", "Product"]),
|
_expandDeparturesJson(httpPackageJson, x, [
|
||||||
|
"ref",
|
||||||
|
"Product",
|
||||||
|
"Directions",
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.cast<Departure>();
|
.cast<Departure>();
|
||||||
|
|||||||
+1
-1
@@ -302,7 +302,7 @@ class DepartureList extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
for (Departure departure in departureList)
|
for (Departure departure in departureList)
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(departure.vehicleName),
|
title: Text('${departure.vehicleName}: ${departure.direction}'),
|
||||||
subtitle: Text(departure.departureTime.toString()),
|
subtitle: Text(departure.departureTime.toString()),
|
||||||
onTap: () => onTapped(departure),
|
onTap: () => onTapped(departure),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -780,6 +780,7 @@ class Departure {
|
|||||||
|
|
||||||
int? id;
|
int? id;
|
||||||
String ref;
|
String ref;
|
||||||
|
String direction;
|
||||||
String vehicleId;
|
String vehicleId;
|
||||||
String vehicleName;
|
String vehicleName;
|
||||||
String stationId;
|
String stationId;
|
||||||
@@ -790,6 +791,7 @@ class Departure {
|
|||||||
Departure({
|
Departure({
|
||||||
this.id,
|
this.id,
|
||||||
required this.ref,
|
required this.ref,
|
||||||
|
required this.direction,
|
||||||
required this.vehicleId,
|
required this.vehicleId,
|
||||||
required this.vehicleName,
|
required this.vehicleName,
|
||||||
required this.stationId,
|
required this.stationId,
|
||||||
@@ -802,6 +804,7 @@ class Departure {
|
|||||||
return {
|
return {
|
||||||
"id": id,
|
"id": id,
|
||||||
"ref": ref,
|
"ref": ref,
|
||||||
|
"direction": direction,
|
||||||
"vehicle": vehicleId,
|
"vehicle": vehicleId,
|
||||||
"vehiclename": vehicleName,
|
"vehiclename": vehicleName,
|
||||||
"station": stationId,
|
"station": stationId,
|
||||||
@@ -815,6 +818,7 @@ class Departure {
|
|||||||
return Departure(
|
return Departure(
|
||||||
id: map["id"] as int,
|
id: map["id"] as int,
|
||||||
ref: map["ref"] as String,
|
ref: map["ref"] as String,
|
||||||
|
direction: map["direction"] as String,
|
||||||
vehicleId: map["vehicle"] as String,
|
vehicleId: map["vehicle"] as String,
|
||||||
vehicleName: map["vehiclename"] as String,
|
vehicleName: map["vehiclename"] as String,
|
||||||
stationId: map["station"] as String,
|
stationId: map["station"] as String,
|
||||||
@@ -869,6 +873,9 @@ class Departure {
|
|||||||
// ["JourneyDetailRef"]["ref"] cannot be caught if ["JourneyDetailRef"]
|
// ["JourneyDetailRef"]["ref"] cannot be caught if ["JourneyDetailRef"]
|
||||||
// is non-existent
|
// is non-existent
|
||||||
ref: json["ref"] ?? json["JourneyDetailRef"]["ref"] as String,
|
ref: json["ref"] ?? json["JourneyDetailRef"]["ref"] as String,
|
||||||
|
direction:
|
||||||
|
json["direction"] ??
|
||||||
|
json["Directions"]["Direction"][0]["value"], // this is not healthy
|
||||||
vehicleId: vehicle.id,
|
vehicleId: vehicle.id,
|
||||||
vehicleName: vehicle.name,
|
vehicleName: vehicle.name,
|
||||||
stationId: station.id,
|
stationId: station.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user