|
|
|
@ -19,51 +19,60 @@ class DisplayTrainStation extends StatelessWidget {
|
|
|
|
|
Row( |
|
|
|
|
mainAxisSize: MainAxisSize.max, |
|
|
|
|
children: <Widget>[ |
|
|
|
|
Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
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; |
|
|
|
|
Expanded( |
|
|
|
|
flex: 1, |
|
|
|
|
child: Align( |
|
|
|
|
alignment: Alignment.centerLeft, |
|
|
|
|
child: Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
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 > 0 && real == true; |
|
|
|
|
final isOnTime = delay <= 0 && real == true; |
|
|
|
|
final isNotScheduled = false; |
|
|
|
|
|
|
|
|
|
return Badge( |
|
|
|
|
text: station.km.toString(), |
|
|
|
|
caption: 'km', |
|
|
|
|
isNotScheduled: isNotScheduled, |
|
|
|
|
isDelayed: isDelayed, |
|
|
|
|
isOnTime: isOnTime, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
final isDelayed = delay > 0 && real == true; |
|
|
|
|
final isOnTime = delay <= 0 && real == true; |
|
|
|
|
final isNotScheduled = false; |
|
|
|
|
|
|
|
|
|
return Badge( |
|
|
|
|
text: station.km.toString(), |
|
|
|
|
caption: 'km', |
|
|
|
|
isNotScheduled: isNotScheduled, |
|
|
|
|
isDelayed: isDelayed, |
|
|
|
|
isOnTime: isOnTime, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Title( |
|
|
|
|
station: station, |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: Title( |
|
|
|
|
station: station, |
|
|
|
|
), |
|
|
|
|
flex: 1, |
|
|
|
|
child: (station.platform == null) |
|
|
|
|
? Container() |
|
|
|
|
: Align( |
|
|
|
|
alignment: Alignment.centerRight, |
|
|
|
|
child: Badge(text: station.platform!, caption: 'linia',), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (station.platform == null) |
|
|
|
|
Container(width: isSmallScreen(context) ? 42 : 48, height: isSmallScreen(context) ? 42 : 48,) |
|
|
|
|
else |
|
|
|
|
Badge(text: station.platform!, caption: 'linia',), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Time( |
|
|
|
|