|
|
|
@ -18,11 +18,29 @@ class DisplayTrainStation extends StatelessWidget {
|
|
|
|
|
children: <Widget>[ |
|
|
|
|
Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
final delay = station.departure?.status?.delay ?? station.arrival?.status?.delay; |
|
|
|
|
final real = station.departure?.status?.real ?? station.arrival?.status?.real; |
|
|
|
|
final departureStatus = station.departure?.status; |
|
|
|
|
final arrivalStatus = station.arrival?.status; |
|
|
|
|
int delay; |
|
|
|
|
bool real; |
|
|
|
|
if (departureStatus == null) { |
|
|
|
|
delay = arrivalStatus?.delay ?? 0; |
|
|
|
|
real = arrivalStatus?.real ?? false; |
|
|
|
|
} |
|
|
|
|
else if (arrivalStatus == null) { |
|
|
|
|
delay = departureStatus.delay; |
|
|
|
|
real = departureStatus.real; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
delay = departureStatus.delay; |
|
|
|
|
real = departureStatus.real; |
|
|
|
|
if (!real && arrivalStatus.real) { |
|
|
|
|
delay = arrivalStatus.delay; |
|
|
|
|
real = arrivalStatus.real; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
final isDelayed = delay != null && delay > 0 && real == true; |
|
|
|
|
final isOnTime = delay != null && delay <= 0 && real == true; |
|
|
|
|
final isDelayed = delay > 0 && real == true; |
|
|
|
|
final isOnTime = delay <= 0 && real == true; |
|
|
|
|
final isNotScheduled = false; |
|
|
|
|
|
|
|
|
|
return KmBadge( |
|
|
|
|