|
|
|
@ -11,7 +11,11 @@ import 'package:info_tren/pages/train_info_page/view_train/train_info_cupertino_
|
|
|
|
|
import 'package:info_tren/utils/state_to_string.dart'; |
|
|
|
|
|
|
|
|
|
class TrainInfoLoadingCupertino extends TrainInfoLoading { |
|
|
|
|
TrainInfoLoadingCupertino({required String title, String? loadingText}) : super(title: title, loadingText: loadingText, uiDesign: UiDesign.CUPERTINO); |
|
|
|
|
TrainInfoLoadingCupertino({required String title, String? loadingText}) |
|
|
|
|
: super( |
|
|
|
|
title: title, |
|
|
|
|
loadingText: loadingText, |
|
|
|
|
uiDesign: UiDesign.CUPERTINO); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
@ -31,7 +35,11 @@ class TrainInfoErrorCupertino extends TrainInfoError {
|
|
|
|
|
required Object error, |
|
|
|
|
required String title, |
|
|
|
|
Future Function()? refresh, |
|
|
|
|
}) : super(error: error, title: title, refresh: refresh,); |
|
|
|
|
}) : super( |
|
|
|
|
error: error, |
|
|
|
|
title: title, |
|
|
|
|
refresh: refresh, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
@ -62,20 +70,30 @@ class TrainInfoErrorCupertino extends TrainInfoError {
|
|
|
|
|
class TrainInfoCupertino extends StatelessWidget { |
|
|
|
|
final TrainData trainData; |
|
|
|
|
final Future Function()? refresh; |
|
|
|
|
final bool? isRefreshing; |
|
|
|
|
|
|
|
|
|
TrainInfoCupertino({required this.trainData, this.refresh,}); |
|
|
|
|
TrainInfoCupertino({ |
|
|
|
|
required this.trainData, |
|
|
|
|
this.refresh, |
|
|
|
|
this.isRefreshing, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return CupertinoPageScaffold( |
|
|
|
|
navigationBar: CupertinoNavigationBar( |
|
|
|
|
middle: Text("Informații despre ${trainData.rank} ${trainData.number}"), |
|
|
|
|
trailing: refresh == null ? null : isRefreshing == true ? CupertinoActivityIndicator() : CupertinoButton( |
|
|
|
|
padding: const EdgeInsets.all(0), |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
child: Icon(CupertinoIcons.refresh), |
|
|
|
|
onPressed: () => refresh!(), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: SafeArea( |
|
|
|
|
top: false, |
|
|
|
|
bottom: false, |
|
|
|
|
child: Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
child: Builder(builder: (context) { |
|
|
|
|
final topPadding = MediaQuery.of(context).padding.top; |
|
|
|
|
|
|
|
|
|
return NestedScrollView( |
|
|
|
@ -86,16 +104,18 @@ class TrainInfoCupertino extends StatelessWidget {
|
|
|
|
|
// top: topPadding, |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
SliverPersistentHeaderPadding(maxHeight: topPadding,) |
|
|
|
|
SliverPersistentHeaderPadding( |
|
|
|
|
maxHeight: topPadding, |
|
|
|
|
) |
|
|
|
|
]; |
|
|
|
|
}, |
|
|
|
|
body: Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
body: Builder(builder: (context) { |
|
|
|
|
return CustomScrollView( |
|
|
|
|
slivers: <Widget>[ |
|
|
|
|
if (refresh != null) |
|
|
|
|
CupertinoSliverRefreshControl( |
|
|
|
|
builder: (context, mode, pulledExtent, refreshTriggerPullDistance, refreshIndicatorExtent) { |
|
|
|
|
builder: (context, mode, pulledExtent, |
|
|
|
|
refreshTriggerPullDistance, refreshIndicatorExtent) { |
|
|
|
|
return Column( |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
children: [ |
|
|
|
@ -104,35 +124,40 @@ class TrainInfoCupertino extends StatelessWidget {
|
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
height: min(refreshIndicatorExtent, pulledExtent), |
|
|
|
|
height: min( |
|
|
|
|
refreshIndicatorExtent, pulledExtent), |
|
|
|
|
child: Center( |
|
|
|
|
child: Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
if (mode == RefreshIndicatorMode.inactive) { |
|
|
|
|
if (mode == |
|
|
|
|
RefreshIndicatorMode.inactive) { |
|
|
|
|
return Container(); |
|
|
|
|
} |
|
|
|
|
else if (mode == RefreshIndicatorMode.done) { |
|
|
|
|
} else if (mode == |
|
|
|
|
RefreshIndicatorMode.done) { |
|
|
|
|
return Text('Refreshed!'); |
|
|
|
|
} |
|
|
|
|
else if (mode == RefreshIndicatorMode.drag) { |
|
|
|
|
} else if (mode == |
|
|
|
|
RefreshIndicatorMode.drag) { |
|
|
|
|
return Row( |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
children: [ |
|
|
|
|
CupertinoActivityIndicator(animating: false,), |
|
|
|
|
CupertinoActivityIndicator( |
|
|
|
|
animating: false, |
|
|
|
|
), |
|
|
|
|
Text('Pull to refresh...'), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else if (mode == RefreshIndicatorMode.armed) { |
|
|
|
|
} else if (mode == |
|
|
|
|
RefreshIndicatorMode.armed) { |
|
|
|
|
return Row( |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
children: [ |
|
|
|
|
CupertinoActivityIndicator(animating: false,), |
|
|
|
|
CupertinoActivityIndicator( |
|
|
|
|
animating: false, |
|
|
|
|
), |
|
|
|
|
Text('Release to refresh...'), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
} else { |
|
|
|
|
return Row( |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
children: [ |
|
|
|
@ -145,7 +170,9 @@ class TrainInfoCupertino extends StatelessWidget {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded(child: Container(),), |
|
|
|
|
Expanded( |
|
|
|
|
child: Container(), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -154,16 +181,26 @@ class TrainInfoCupertino extends StatelessWidget {
|
|
|
|
|
}, |
|
|
|
|
onRefresh: refresh, |
|
|
|
|
), |
|
|
|
|
DisplayTrainID(trainData: trainData,), |
|
|
|
|
DisplayTrainOperator(trainData: trainData,), |
|
|
|
|
DisplayTrainRoute(trainData: trainData,), |
|
|
|
|
DisplayTrainDeparture(trainData: trainData,), |
|
|
|
|
DisplayTrainID( |
|
|
|
|
trainData: trainData, |
|
|
|
|
), |
|
|
|
|
DisplayTrainOperator( |
|
|
|
|
trainData: trainData, |
|
|
|
|
), |
|
|
|
|
DisplayTrainRoute( |
|
|
|
|
trainData: trainData, |
|
|
|
|
), |
|
|
|
|
DisplayTrainDeparture( |
|
|
|
|
trainData: trainData, |
|
|
|
|
), |
|
|
|
|
SliverToBoxAdapter( |
|
|
|
|
child: CupertinoDivider( |
|
|
|
|
color: FOREGROUND_WHITE, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
DisplayTrainLastInfo(trainData: trainData,), |
|
|
|
|
DisplayTrainLastInfo( |
|
|
|
|
trainData: trainData, |
|
|
|
|
), |
|
|
|
|
SliverToBoxAdapter( |
|
|
|
|
child: CupertinoDivider(), |
|
|
|
|
), |
|
|
|
@ -175,13 +212,22 @@ class TrainInfoCupertino extends StatelessWidget {
|
|
|
|
|
// child: DisplayTrainNextStop(trainData: trainData,), |
|
|
|
|
// ), |
|
|
|
|
Expanded( |
|
|
|
|
child: DisplayTrainDestination(trainData: trainData,), |
|
|
|
|
child: DisplayTrainRouteDuration( |
|
|
|
|
trainData: trainData, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
// Expanded( |
|
|
|
|
// child: DisplayTrainDestination(trainData: trainData,), |
|
|
|
|
// ), |
|
|
|
|
SizedBox( |
|
|
|
|
height: double.infinity, |
|
|
|
|
child: CupertinoVerticalDivider(), |
|
|
|
|
), |
|
|
|
|
Expanded(child: DisplayTrainRouteDistance(trainData: trainData,),), |
|
|
|
|
Expanded( |
|
|
|
|
child: DisplayTrainRouteDistance( |
|
|
|
|
trainData: trainData, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -223,11 +269,9 @@ class TrainInfoCupertino extends StatelessWidget {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
), |
|
|
|
|
}), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
), |
|
|
|
|
}), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
@ -346,8 +390,19 @@ class DisplayTrainID extends StatelessWidget {
|
|
|
|
|
child: Center( |
|
|
|
|
child: Padding( |
|
|
|
|
padding: const EdgeInsets.all(8.0), |
|
|
|
|
child: Text( |
|
|
|
|
"${trainData.rank} ${trainData.number}", |
|
|
|
|
child: Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: trainData.rank, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: trainData.rank.startsWith('IR') ? Color.fromARGB(255, 255, 0, 0) : null, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan(text: ' '), |
|
|
|
|
TextSpan(text: trainData.number,), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
style: CupertinoTheme.of(context).textTheme.navLargeTitleTextStyle, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -366,32 +421,36 @@ class DisplayTrainRoute extends StatelessWidget {
|
|
|
|
|
return SliverToBoxAdapter( |
|
|
|
|
child: Row( |
|
|
|
|
children: <Widget>[ |
|
|
|
|
Center( |
|
|
|
|
Expanded( |
|
|
|
|
child: Center( |
|
|
|
|
child: Padding( |
|
|
|
|
padding: const EdgeInsets.all(4), |
|
|
|
|
child: Text( |
|
|
|
|
trainData.route.from, |
|
|
|
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
style: |
|
|
|
|
CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
fontSize: 16, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded(child: Container(),), |
|
|
|
|
), |
|
|
|
|
Center(child: Text("-")), |
|
|
|
|
Expanded(child: Container(),), |
|
|
|
|
Center( |
|
|
|
|
Expanded( |
|
|
|
|
child: Center( |
|
|
|
|
child: Padding( |
|
|
|
|
padding: const EdgeInsets.all(4), |
|
|
|
|
child: Text( |
|
|
|
|
trainData.route.to, |
|
|
|
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
style: |
|
|
|
|
CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
fontSize: 16, |
|
|
|
|
), |
|
|
|
|
textAlign: TextAlign.right, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
@ -451,7 +510,9 @@ class DisplayTrainLastInfo extends StatelessWidget {
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
if (trainData.status == null) { |
|
|
|
|
return SliverToBoxAdapter(child: Container(),); |
|
|
|
|
return SliverToBoxAdapter( |
|
|
|
|
child: Container(), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return SliverToBoxAdapter( |
|
|
|
@ -480,7 +541,9 @@ class DisplayTrainLastInfo extends StatelessWidget {
|
|
|
|
|
textAlign: TextAlign.left, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded(child: Container(),), |
|
|
|
|
Expanded( |
|
|
|
|
child: Container(), |
|
|
|
|
), |
|
|
|
|
Padding( |
|
|
|
|
padding: const EdgeInsets.all(4), |
|
|
|
|
child: Text( |
|
|
|
@ -510,17 +573,18 @@ class DisplayTrainLastInfo extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
if (data > 0) { |
|
|
|
|
return Text( |
|
|
|
|
"$data minute întârziere", |
|
|
|
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
"$data ${data == 1 ? 'minut' : 'minute'} întârziere", |
|
|
|
|
style: |
|
|
|
|
CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
fontSize: 14, |
|
|
|
|
color: CupertinoColors.destructiveRed, |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
} else { |
|
|
|
|
return Text( |
|
|
|
|
"${-data} minute mai devreme", |
|
|
|
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
"${-data} ${data == -1 ? 'minut' : 'minute'} mai devreme", |
|
|
|
|
style: |
|
|
|
|
CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
fontSize: 12, |
|
|
|
|
color: CupertinoColors.activeGreen, |
|
|
|
|
), |
|
|
|
@ -649,12 +713,14 @@ class DisplayTrainDestination extends StatelessWidget {
|
|
|
|
|
), |
|
|
|
|
Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
final arrival = trainData.stations.last.arrival!.scheduleTime; |
|
|
|
|
final arrival = |
|
|
|
|
DateTime.parse(trainData.stations.last.arrival!.scheduleTime); |
|
|
|
|
final delay = trainData.stations.last.arrival!.status?.delay ?? 0; |
|
|
|
|
final parts = arrival.split(':'); |
|
|
|
|
final arrivalDT = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, int.parse(parts[0]), int.parse(parts[1])); |
|
|
|
|
final arrivalWithDelay = arrivalDT.add(Duration(minutes: delay)); |
|
|
|
|
final arrivalWithDelayString = '${arrivalWithDelay.hour}:${arrivalWithDelay.minute.toString().padLeft(2, "0")}'; |
|
|
|
|
// final parts = arrival.split(':'); |
|
|
|
|
// final arrivalDT = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, int.parse(parts[0]), int.parse(parts[1])); |
|
|
|
|
final arrivalWithDelay = arrival.add(Duration(minutes: delay)); |
|
|
|
|
final arrivalWithDelayString = |
|
|
|
|
'${arrivalWithDelay.hour}:${arrivalWithDelay.minute.toString().padLeft(2, "0")}'; |
|
|
|
|
// const months = ["ian", "feb", "mar", "apr", "mai", "iun", "iul", "aug", "sep", "oct", "noi", "dec"]; |
|
|
|
|
|
|
|
|
|
return Column( |
|
|
|
@ -673,8 +739,11 @@ class DisplayTrainDestination extends StatelessWidget {
|
|
|
|
|
children: [ |
|
|
|
|
TextSpan(text: ' '), |
|
|
|
|
TextSpan( |
|
|
|
|
text: '$arrival', |
|
|
|
|
style: delay == 0 ? null : TextStyle( |
|
|
|
|
text: |
|
|
|
|
'${arrival.hour.toString().padLeft(2, "0")}:${arrival.minute.toString().padLeft(2, "0")}', |
|
|
|
|
style: delay == 0 |
|
|
|
|
? null |
|
|
|
|
: TextStyle( |
|
|
|
|
decoration: TextDecoration.lineThrough, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -683,14 +752,17 @@ class DisplayTrainDestination extends StatelessWidget {
|
|
|
|
|
TextSpan( |
|
|
|
|
text: '$arrivalWithDelayString', |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: delay > 0 ? CupertinoColors.destructiveRed : CupertinoColors.activeGreen, |
|
|
|
|
color: delay > 0 |
|
|
|
|
? CupertinoColors.destructiveRed |
|
|
|
|
: CupertinoColors.activeGreen, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
] |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
// "la ${arrival.hour.toString().padLeft(2, '0')}:${arrival.minute.toString().padLeft(2, '0')}", |
|
|
|
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
style: |
|
|
|
|
CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
fontSize: 14, |
|
|
|
|
), |
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
@ -734,76 +806,87 @@ class DisplayTrainRouteDistance extends StatelessWidget {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// class DisplayTrainRouteDuration extends StatelessWidget { |
|
|
|
|
// final TrainData trainData; |
|
|
|
|
// |
|
|
|
|
// DisplayTrainRouteDuration({required this.trainData}); |
|
|
|
|
// |
|
|
|
|
// @override |
|
|
|
|
// Widget build(BuildContext context) { |
|
|
|
|
// return Column( |
|
|
|
|
// mainAxisSize: MainAxisSize.min, |
|
|
|
|
// children: <Widget>[ |
|
|
|
|
// Text( |
|
|
|
|
// "Durata rutei", |
|
|
|
|
// style: CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
// fontSize: 18, |
|
|
|
|
// fontWeight: FontWeight.bold, |
|
|
|
|
// ), |
|
|
|
|
// textAlign: TextAlign.center, |
|
|
|
|
// ), |
|
|
|
|
// FutureDisplay<Duration>( |
|
|
|
|
// future: trainData.routeDuration, |
|
|
|
|
// builder: (context, duration) { |
|
|
|
|
// var durationString = StringBuffer(); |
|
|
|
|
// |
|
|
|
|
// bool firstWritten = false; |
|
|
|
|
// |
|
|
|
|
// if (duration.inDays > 0) { |
|
|
|
|
// firstWritten = true; |
|
|
|
|
// if (duration.inDays == 1) durationString.write("1 zi"); |
|
|
|
|
// else durationString.write("${duration.inDays} zile"); |
|
|
|
|
// duration -= Duration(days: duration.inDays); |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// if (duration.inHours > 0) { |
|
|
|
|
// if (firstWritten) { |
|
|
|
|
// durationString.write(", "); |
|
|
|
|
// } |
|
|
|
|
// firstWritten = true; |
|
|
|
|
// if (duration.inHours == 1) durationString.write("1 oră"); |
|
|
|
|
// else durationString.write("${duration.inHours} ore"); |
|
|
|
|
// duration -= Duration(hours: duration.inHours); |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// if (duration.inMinutes > 0) { |
|
|
|
|
// if (firstWritten) { |
|
|
|
|
// durationString.write(", "); |
|
|
|
|
// } |
|
|
|
|
// firstWritten = true; |
|
|
|
|
// if (duration.inMinutes == 1) durationString.write("1 minut"); |
|
|
|
|
// else durationString.write("${duration.inMinutes} minute"); |
|
|
|
|
// duration -= Duration(minutes: duration.inMinutes); |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// return Text( |
|
|
|
|
// durationString.toString(), |
|
|
|
|
// style: CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
// fontSize: 16, |
|
|
|
|
// ), |
|
|
|
|
// textAlign: TextAlign.center, |
|
|
|
|
// ); |
|
|
|
|
// }, |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ); |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
class DisplayTrainRouteDuration extends StatelessWidget { |
|
|
|
|
final TrainData trainData; |
|
|
|
|
|
|
|
|
|
DisplayTrainRouteDuration({required this.trainData}); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return Column( |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
children: <Widget>[ |
|
|
|
|
Text( |
|
|
|
|
"Durata rutei", |
|
|
|
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
fontSize: 18, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
), |
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
), |
|
|
|
|
Builder( |
|
|
|
|
builder: (context) { |
|
|
|
|
var duration = |
|
|
|
|
DateTime.parse(trainData.stations.last.arrival!.scheduleTime) |
|
|
|
|
.difference(DateTime.parse( |
|
|
|
|
trainData.stations.first.departure!.scheduleTime)); |
|
|
|
|
var durationString = StringBuffer(); |
|
|
|
|
|
|
|
|
|
bool firstWritten = false; |
|
|
|
|
|
|
|
|
|
if (duration.inDays > 0) { |
|
|
|
|
firstWritten = true; |
|
|
|
|
if (duration.inDays == 1) |
|
|
|
|
durationString.write("1 zi"); |
|
|
|
|
else |
|
|
|
|
durationString.write("${duration.inDays} zile"); |
|
|
|
|
duration -= Duration(days: duration.inDays); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (duration.inHours > 0) { |
|
|
|
|
if (firstWritten) { |
|
|
|
|
durationString.write(", "); |
|
|
|
|
} |
|
|
|
|
firstWritten = true; |
|
|
|
|
if (duration.inHours == 1) |
|
|
|
|
durationString.write("1 oră"); |
|
|
|
|
else |
|
|
|
|
durationString.write("${duration.inHours} ore"); |
|
|
|
|
duration -= Duration(hours: duration.inHours); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (duration.inMinutes > 0) { |
|
|
|
|
if (firstWritten) { |
|
|
|
|
durationString.write(", "); |
|
|
|
|
} |
|
|
|
|
firstWritten = true; |
|
|
|
|
if (duration.inMinutes == 1) |
|
|
|
|
durationString.write("1 minut"); |
|
|
|
|
else |
|
|
|
|
durationString.write("${duration.inMinutes} minute"); |
|
|
|
|
duration -= Duration(minutes: duration.inMinutes); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Text( |
|
|
|
|
durationString.toString(), |
|
|
|
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
fontSize: 16, |
|
|
|
|
), |
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class DisplayTrainStations extends StatelessWidget { |
|
|
|
|
final TrainData trainData; |
|
|
|
|
|
|
|
|
|
DisplayTrainStations({required this.trainData,}); |
|
|
|
|
DisplayTrainStations({ |
|
|
|
|
required this.trainData, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
@ -812,8 +895,7 @@ class DisplayTrainStations extends StatelessWidget {
|
|
|
|
|
(context, index) { |
|
|
|
|
if (index.isOdd) { |
|
|
|
|
return CupertinoDivider(); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
} else { |
|
|
|
|
final itemIndex = index ~/ 2; |
|
|
|
|
return IndexedSemantics( |
|
|
|
|
child: DisplayTrainStation( |
|
|
|
|