|
|
|
@ -49,241 +49,140 @@ class ViewStationPageStateMaterial extends ViewStationPageState {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget buildStationArrivalItem(BuildContext context, StationArrDep item) { |
|
|
|
|
Widget buildStationItem(BuildContext context, StationArrDep item, {required bool arrival}) { |
|
|
|
|
return InkWell( |
|
|
|
|
onTap: () => onTrainTapped(item.train.number), |
|
|
|
|
child: Row( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Padding( |
|
|
|
|
padding: const EdgeInsets.all(8), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
'${item.time.toLocal().hour.toString().padLeft(2, '0')}:${item.time.toLocal().minute.toString().padLeft(2, '0')}', |
|
|
|
|
style: TextStyle( |
|
|
|
|
inherit: true, |
|
|
|
|
fontFeatures: [ |
|
|
|
|
FontFeature.tabularFigures(), |
|
|
|
|
], |
|
|
|
|
decoration: item.status.delay != 0 ? TextDecoration.lineThrough : null, |
|
|
|
|
fontSize: item.status.delay != 0 ? 12 : null, |
|
|
|
|
onTap: () => onTrainTapped(item.train), |
|
|
|
|
child: Container( |
|
|
|
|
color: item.status.cancelled ? Colors.red.withAlpha(100) : null, |
|
|
|
|
child: Row( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Padding( |
|
|
|
|
padding: const EdgeInsets.all(8), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
'${item.time.toLocal().hour.toString().padLeft(2, '0')}:${item.time.toLocal().minute.toString().padLeft(2, '0')}', |
|
|
|
|
style: TextStyle( |
|
|
|
|
inherit: true, |
|
|
|
|
fontFeatures: [ |
|
|
|
|
FontFeature.tabularFigures(), |
|
|
|
|
], |
|
|
|
|
decoration: item.status.cancelled || item.status.delay != 0 ? TextDecoration.lineThrough : null, |
|
|
|
|
fontSize: item.status.delay != 0 ? 12 : null, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (item.status.delay != 0) Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
final newTime = item.time.add(Duration(minutes: item.status.delay)); |
|
|
|
|
final delay = item.status.delay > 0; |
|
|
|
|
if (item.status.delay != 0) Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
final newTime = item.time.add(Duration(minutes: item.status.delay)); |
|
|
|
|
final delay = item.status.delay > 0; |
|
|
|
|
|
|
|
|
|
return Text( |
|
|
|
|
'${newTime.toLocal().hour.toString().padLeft(2, '0')}:${newTime.toLocal().minute.toString().padLeft(2, '0')}', |
|
|
|
|
style: TextStyle( |
|
|
|
|
inherit: true, |
|
|
|
|
fontFeatures: [ |
|
|
|
|
FontFeature.tabularFigures(), |
|
|
|
|
], |
|
|
|
|
color: delay ? Colors.red : Colors.green, |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: IgnorePointer( |
|
|
|
|
child: ListTile( |
|
|
|
|
isThreeLine: item.status.delay != 0, |
|
|
|
|
title: Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: item.train.rank, |
|
|
|
|
return Text( |
|
|
|
|
'${newTime.toLocal().hour.toString().padLeft(2, '0')}:${newTime.toLocal().minute.toString().padLeft(2, '0')}', |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: item.train.rank.startsWith('IR') ? Color.fromARGB(255, 255, 0, 0) : null, |
|
|
|
|
inherit: true, |
|
|
|
|
fontFeatures: [ |
|
|
|
|
FontFeature.tabularFigures(), |
|
|
|
|
], |
|
|
|
|
color: delay ? Colors.red : Colors.green, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan(text: ' '), |
|
|
|
|
TextSpan(text: item.train.number,), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
subtitle: Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan(text: item.time.add(Duration(minutes: max(0, item.status.delay))).compareTo(DateTime.now()) < 0 ? ViewStationPageState.arrivedFrom : ViewStationPageState.arrivesFrom), |
|
|
|
|
TextSpan(text: ' '), |
|
|
|
|
TextSpan(text: item.train.terminus), |
|
|
|
|
if (item.status.delay != 0) ...[ |
|
|
|
|
TextSpan(text: '\n'), |
|
|
|
|
if (item.status.delay.abs() >= 60) ...[ |
|
|
|
|
TextSpan(text: (item.status.delay.abs() ~/ 60).toString()), |
|
|
|
|
TextSpan(text: item.status.delay.abs() >= 120 ? ' ore' : ' oră'), |
|
|
|
|
if (item.status.delay.abs() % 60 != 0) |
|
|
|
|
TextSpan(text: ' și '), |
|
|
|
|
], |
|
|
|
|
TextSpan(text: (item.status.delay.abs() % 60).toString()), |
|
|
|
|
TextSpan(text: item.status.delay.abs() > 1 ? ' minute' : ' minut'), |
|
|
|
|
TextSpan(text: ' '), |
|
|
|
|
if (item.status.delay > 0) |
|
|
|
|
TextSpan( |
|
|
|
|
text: 'întârziere', |
|
|
|
|
style: TextStyle( |
|
|
|
|
inherit: true, |
|
|
|
|
color: Colors.red, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
else |
|
|
|
|
TextSpan( |
|
|
|
|
text: 'mai devreme', |
|
|
|
|
style: TextStyle( |
|
|
|
|
inherit: true, |
|
|
|
|
color: Colors.green, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (item.status.platform != null) |
|
|
|
|
IntrinsicHeight( |
|
|
|
|
child: AspectRatio( |
|
|
|
|
aspectRatio: 1, |
|
|
|
|
child: MaterialBadge( |
|
|
|
|
text: item.status.platform!, |
|
|
|
|
caption: 'Linia', |
|
|
|
|
isOnTime: item.status.real && item.status.delay <= 0, |
|
|
|
|
isDelayed: item.status.real && item.status.delay > 0, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget buildStationDepartureItem(BuildContext context, StationArrDep item) { |
|
|
|
|
return InkWell( |
|
|
|
|
onTap: () => onTrainTapped(item.train.number), |
|
|
|
|
child: Row( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Padding( |
|
|
|
|
padding: const EdgeInsets.all(8), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
'${item.time.toLocal().hour.toString().padLeft(2, '0')}:${item.time.toLocal().minute.toString().padLeft(2, '0')}', |
|
|
|
|
style: TextStyle( |
|
|
|
|
inherit: true, |
|
|
|
|
fontFeatures: [ |
|
|
|
|
FontFeature.tabularFigures(), |
|
|
|
|
], |
|
|
|
|
decoration: item.status.delay != 0 ? TextDecoration.lineThrough : null, |
|
|
|
|
fontSize: item.status.delay != 0 ? 12 : null, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (item.status.delay != 0) Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
final newTime = item.time.add(Duration(minutes: item.status.delay)); |
|
|
|
|
final delay = item.status.delay > 0; |
|
|
|
|
|
|
|
|
|
return Text( |
|
|
|
|
'${newTime.toLocal().hour.toString().padLeft(2, '0')}:${newTime.toLocal().minute.toString().padLeft(2, '0')}', |
|
|
|
|
style: TextStyle( |
|
|
|
|
inherit: true, |
|
|
|
|
fontFeatures: [ |
|
|
|
|
FontFeature.tabularFigures(), |
|
|
|
|
], |
|
|
|
|
color: delay ? Colors.red : Colors.green, |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: IgnorePointer( |
|
|
|
|
child: ListTile( |
|
|
|
|
isThreeLine: item.status.delay != 0, |
|
|
|
|
title: Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: item.train.rank, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: item.train.rank.startsWith('IR') ? Color.fromARGB(255, 255, 0, 0) : null, |
|
|
|
|
Expanded( |
|
|
|
|
child: IgnorePointer( |
|
|
|
|
child: ListTile( |
|
|
|
|
isThreeLine: item.status.delay != 0, |
|
|
|
|
title: Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: item.train.rank, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: item.train.rank.startsWith('IR') ? Color.fromARGB(255, 255, 0, 0) : null, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan(text: ' '), |
|
|
|
|
TextSpan(text: item.train.number,), |
|
|
|
|
], |
|
|
|
|
TextSpan(text: ' '), |
|
|
|
|
TextSpan(text: item.train.number,), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
subtitle: Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan(text: item.time.add(Duration(minutes: max(0, item.status.delay))).compareTo(DateTime.now()) < 0 ? ViewStationPageState.departedTo : ViewStationPageState.departsTo), |
|
|
|
|
TextSpan(text: ' '), |
|
|
|
|
TextSpan(text: item.train.terminus), |
|
|
|
|
if (item.status.delay != 0) ...[ |
|
|
|
|
TextSpan(text: '\n'), |
|
|
|
|
if (item.status.delay.abs() >= 60) ...[ |
|
|
|
|
TextSpan(text: (item.status.delay.abs() ~/ 60).toString()), |
|
|
|
|
TextSpan(text: item.status.delay.abs() >= 120 ? ' ore' : ' oră'), |
|
|
|
|
if (item.status.delay.abs() % 60 != 0) |
|
|
|
|
TextSpan(text: ' și '), |
|
|
|
|
], |
|
|
|
|
TextSpan(text: (item.status.delay.abs() % 60).toString()), |
|
|
|
|
TextSpan(text: item.status.delay.abs() > 1 ? ' minute' : ' minut'), |
|
|
|
|
subtitle: Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: item.status.cancelled |
|
|
|
|
? (arrival ? ViewStationPageState.cancelledArrival : ViewStationPageState.cancelledDeparture) |
|
|
|
|
: item.time.add(Duration(minutes: max(0, item.status.delay))).compareTo(DateTime.now()) < 0 |
|
|
|
|
? (arrival ? ViewStationPageState.arrivedFrom : ViewStationPageState.departedTo) |
|
|
|
|
: (arrival ? ViewStationPageState.arrivesFrom : ViewStationPageState.departsTo) |
|
|
|
|
), |
|
|
|
|
TextSpan(text: ' '), |
|
|
|
|
if (item.status.delay > 0) |
|
|
|
|
TextSpan( |
|
|
|
|
text: 'întârziere', |
|
|
|
|
style: TextStyle( |
|
|
|
|
inherit: true, |
|
|
|
|
color: Colors.red, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
else |
|
|
|
|
TextSpan( |
|
|
|
|
text: 'mai devreme', |
|
|
|
|
style: TextStyle( |
|
|
|
|
inherit: true, |
|
|
|
|
color: Colors.green, |
|
|
|
|
TextSpan(text: item.train.terminus), |
|
|
|
|
if (item.status.delay != 0) ...[ |
|
|
|
|
TextSpan(text: '\n'), |
|
|
|
|
if (item.status.delay.abs() >= 60) ...[ |
|
|
|
|
TextSpan(text: (item.status.delay.abs() ~/ 60).toString()), |
|
|
|
|
TextSpan(text: item.status.delay.abs() >= 120 ? ' ore' : ' oră'), |
|
|
|
|
if (item.status.delay.abs() % 60 != 0) |
|
|
|
|
TextSpan(text: ' și '), |
|
|
|
|
], |
|
|
|
|
TextSpan(text: (item.status.delay.abs() % 60).toString()), |
|
|
|
|
TextSpan(text: item.status.delay.abs() > 1 ? ' minute' : ' minut'), |
|
|
|
|
TextSpan(text: ' '), |
|
|
|
|
if (item.status.delay > 0) |
|
|
|
|
TextSpan( |
|
|
|
|
text: 'întârziere', |
|
|
|
|
style: TextStyle( |
|
|
|
|
inherit: true, |
|
|
|
|
color: Colors.red, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
else |
|
|
|
|
TextSpan( |
|
|
|
|
text: 'mai devreme', |
|
|
|
|
style: TextStyle( |
|
|
|
|
inherit: true, |
|
|
|
|
color: Colors.green, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
], |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (item.status.platform != null) |
|
|
|
|
IntrinsicHeight( |
|
|
|
|
child: AspectRatio( |
|
|
|
|
aspectRatio: 1, |
|
|
|
|
child: MaterialBadge( |
|
|
|
|
text: item.status.platform!, |
|
|
|
|
caption: 'Linia', |
|
|
|
|
isOnTime: item.status.real && item.status.delay <= 0, |
|
|
|
|
isDelayed: item.status.real && item.status.delay > 0, |
|
|
|
|
if (item.status.platform != null) |
|
|
|
|
IntrinsicHeight( |
|
|
|
|
child: AspectRatio( |
|
|
|
|
aspectRatio: 1, |
|
|
|
|
child: MaterialBadge( |
|
|
|
|
text: item.status.platform!, |
|
|
|
|
caption: 'Linia', |
|
|
|
|
isOnTime: item.status.real && item.status.delay <= 0, |
|
|
|
|
isDelayed: item.status.real && item.status.delay > 0, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget buildStationArrivalItem(BuildContext context, StationArrDep item) { |
|
|
|
|
return buildStationItem(context, item, arrival: true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget buildStationDepartureItem(BuildContext context, StationArrDep item) { |
|
|
|
|
return buildStationItem(context, item, arrival: false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|