@ -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,174 +70,210 @@ 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 } " ) ,
) ,
child: SafeArea (
top: false ,
bottom: false ,
child: Builder (
builder: ( context ) {
final topPadding = MediaQuery . of ( context ) . padding . top ;
return NestedScrollView (
headerSliverBuilder: ( context , innerBoxIsScrolled ) {
return [
/ / SliverPadding (
/ / padding: EdgeInsets . only (
/ / top: topPadding ,
/ / ) ,
/ / ) ,
SliverPersistentHeaderPadding ( maxHeight: topPadding , )
] ;
} ,
body: Builder (
builder: ( context ) {
return CustomScrollView (
slivers: < Widget > [
if ( refresh ! = null )
CupertinoSliverRefreshControl (
builder: ( context , mode , pulledExtent , refreshTriggerPullDistance , refreshIndicatorExtent ) {
return Column (
mainAxisSize: MainAxisSize . min ,
children: [
Container (
height: pulledExtent ,
child: Column (
children: [
Container (
height: min ( refreshIndicatorExtent , pulledExtent ) ,
child: Center (
child: Builder (
builder: ( context ) {
if ( mode = = RefreshIndicatorMode . inactive ) {
return Container ( ) ;
}
else if ( mode = = RefreshIndicatorMode . done ) {
return Text ( ' Refreshed! ' ) ;
}
else if ( mode = = RefreshIndicatorMode . drag ) {
return Row (
mainAxisSize: MainAxisSize . min ,
children: [
CupertinoActivityIndicator ( animating: false , ) ,
Text ( ' Pull to refresh... ' ) ,
] ,
) ;
}
else if ( mode = = RefreshIndicatorMode . armed ) {
return Row (
mainAxisSize: MainAxisSize . min ,
children: [
CupertinoActivityIndicator ( animating: false , ) ,
Text ( ' Release to refresh... ' ) ,
] ,
) ;
}
else {
return Row (
mainAxisSize: MainAxisSize . min ,
children: [
CupertinoActivityIndicator ( ) ,
Text ( ' Refreshing ' ) ,
] ,
) ;
}
} ,
) ,
) ,
) ,
Expanded ( child: Container ( ) , ) ,
] ,
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 ) {
final topPadding = MediaQuery . of ( context ) . padding . top ;
return NestedScrollView (
headerSliverBuilder: ( context , innerBoxIsScrolled ) {
return [
/ / SliverPadding (
/ / padding: EdgeInsets . only (
/ / top: topPadding ,
/ / ) ,
/ / ) ,
SliverPersistentHeaderPadding (
maxHeight: topPadding ,
)
] ;
} ,
body: Builder ( builder: ( context ) {
return CustomScrollView (
slivers: < Widget > [
if ( refresh ! = null )
CupertinoSliverRefreshControl (
builder: ( context , mode , pulledExtent ,
refreshTriggerPullDistance , refreshIndicatorExtent ) {
return Column (
mainAxisSize: MainAxisSize . min ,
children: [
Container (
height: pulledExtent ,
child: Column (
children: [
Container (
height: min (
refreshIndicatorExtent , pulledExtent ) ,
child: Center (
child: Builder (
builder: ( context ) {
if ( mode = =
RefreshIndicatorMode . inactive ) {
return Container ( ) ;
} else if ( mode = =
RefreshIndicatorMode . done ) {
return Text ( ' Refreshed! ' ) ;
} else if ( mode = =
RefreshIndicatorMode . drag ) {
return Row (
mainAxisSize: MainAxisSize . min ,
children: [
CupertinoActivityIndicator (
animating: false ,
) ,
Text ( ' Pull to refresh... ' ) ,
] ,
) ;
} else if ( mode = =
RefreshIndicatorMode . armed ) {
return Row (
mainAxisSize: MainAxisSize . min ,
children: [
CupertinoActivityIndicator (
animating: false ,
) ,
Text ( ' Release to refresh... ' ) ,
] ,
) ;
} else {
return Row (
mainAxisSize: MainAxisSize . min ,
children: [
CupertinoActivityIndicator ( ) ,
Text ( ' Refreshing ' ) ,
] ,
) ;
}
} ,
) ,
) ,
] ,
) ;
} ,
onRefresh: refresh ,
) ,
DisplayTrainID ( trainData: trainData , ) ,
DisplayTrainOperator ( trainData: trainData , ) ,
DisplayTrainRoute ( trainData: trainData , ) ,
DisplayTrainDeparture ( trainData: trainData , ) ,
SliverToBoxAdapter (
child: CupertinoDivider (
color: FOREGROUND_WHITE ,
) ,
) ,
DisplayTrainLastInfo ( trainData: trainData , ) ,
SliverToBoxAdapter (
child: CupertinoDivider ( ) ,
) ,
SliverToBoxAdapter (
child: IntrinsicHeight (
child: Row (
children: < Widget > [
/ / Expanded (
/ / child: DisplayTrainNextStop ( trainData: trainData , ) ,
/ / ) ,
Expanded (
child: DisplayTrainDestination ( trainData: trainData , ) ,
) ,
SizedBox (
height: double . infinity ,
child: CupertinoVerticalDivider ( ) ,
Expanded (
child: Container ( ) ,
) ,
Expanded ( child: DisplayTrainRouteDistance ( trainData: trainData , ) , ) ,
] ,
) ,
) ,
) ,
/ / SliverToBoxAdapter (
/ / child: CupertinoDivider ( ) ,
/ / ) ,
/ / SliverToBoxAdapter (
/ / child: IntrinsicHeight (
/ / child: Row (
/ / children: < Widget > [
/ / / / Expanded (
/ / / / child: DisplayTrainRouteDuration ( trainData: trainData , ) ,
/ / / / ) ,
/ / Expanded ( child: Container ( ) , ) ,
/ / SizedBox (
/ / height: double . infinity ,
/ / child: CupertinoVerticalDivider ( ) ,
/ / ) ,
/ / Expanded (
/ / child: DisplayTrainRouteDistance ( trainData: trainData , ) ,
/ / )
/ / ] ,
/ / ) ,
/ / ) ,
] ,
) ;
} ,
onRefresh: refresh ,
) ,
DisplayTrainID (
trainData: trainData ,
) ,
DisplayTrainOperator (
trainData: trainData ,
) ,
DisplayTrainRoute (
trainData: trainData ,
) ,
DisplayTrainDeparture (
trainData: trainData ,
) ,
SliverToBoxAdapter (
child: CupertinoDivider (
color: FOREGROUND_WHITE ,
) ,
) ,
DisplayTrainLastInfo (
trainData: trainData ,
) ,
SliverToBoxAdapter (
child: CupertinoDivider ( ) ,
) ,
SliverToBoxAdapter (
child: IntrinsicHeight (
child: Row (
children: < Widget > [
/ / Expanded (
/ / child: DisplayTrainNextStop ( trainData: trainData , ) ,
/ / ) ,
SliverToBoxAdapter (
child: CupertinoDivider (
color: FOREGROUND_WHITE ,
Expanded (
child: DisplayTrainRouteDuration (
trainData: trainData ,
) ,
) ,
DisplayTrainStations (
trainData: trainData ,
/ / Expanded (
/ / child: DisplayTrainDestination ( trainData: trainData , ) ,
/ / ) ,
SizedBox (
height: double . infinity ,
child: CupertinoVerticalDivider ( ) ,
) ,
SliverToBoxAdapter (
child: Container (
height: MediaQuery . of ( context ) . viewPadding . bottom ,
Expanded (
child: DisplayTrainRouteDistance (
trainData: trainData ,
) ,
) ,
] ,
) ;
}
) ,
) ,
) ,
) ;
}
) ,
) ,
) ;
/ / SliverToBoxAdapter (
/ / child: CupertinoDivider ( ) ,
/ / ) ,
/ / SliverToBoxAdapter (
/ / child: IntrinsicHeight (
/ / child: Row (
/ / children: < Widget > [
/ / / / Expanded (
/ / / / child: DisplayTrainRouteDuration ( trainData: trainData , ) ,
/ / / / ) ,
/ / Expanded ( child: Container ( ) , ) ,
/ / SizedBox (
/ / height: double . infinity ,
/ / child: CupertinoVerticalDivider ( ) ,
/ / ) ,
/ / Expanded (
/ / child: DisplayTrainRouteDistance ( trainData: trainData , ) ,
/ / )
/ / ] ,
/ / ) ,
/ / ) ,
/ / ) ,
SliverToBoxAdapter (
child: CupertinoDivider (
color: FOREGROUND_WHITE ,
) ,
) ,
DisplayTrainStations (
trainData: trainData ,
) ,
SliverToBoxAdapter (
child: Container (
height: MediaQuery . of ( context ) . viewPadding . bottom ,
) ,
) ,
] ,
) ;
} ) ,
) ;
} ) ,
) ,
) ;
/ / return CupertinoPageScaffold (
/ / navigationBar: CupertinoNavigationBar (
@ -343,11 +387,22 @@ class DisplayTrainID extends StatelessWidget {
@ override
Widget build ( BuildContext context ) {
return SliverToBoxAdapter (
child: Center (
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 ,
) ,
) ,
@ -364,31 +419,35 @@ class DisplayTrainRoute extends StatelessWidget {
@ override
Widget build ( BuildContext context ) {
return SliverToBoxAdapter (
child: Row (
child: Row (
children: < Widget > [
Center (
child: Padding (
padding: const EdgeInsets . all ( 4 ) ,
child: Text (
trainData . route . from ,
style: CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 16 ,
Expanded (
child: Center (
child: Padding (
padding: const EdgeInsets . all ( 4 ) ,
child: Text (
trainData . route . from ,
style:
CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 16 ,
) ,
) ,
) ,
) ,
) ,
Expanded ( child: Container ( ) , ) ,
Center ( child: Text ( " - " ) ) ,
Expanded ( child: Container ( ) , ) ,
Center (
child: Padding (
padding: const EdgeInsets . all ( 4 ) ,
child: Text (
trainData . route . to ,
style: CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 16 ,
Expanded (
child: Center (
child: Padding (
padding: const EdgeInsets . all ( 4 ) ,
child: Text (
trainData . route . to ,
style:
CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 16 ,
) ,
textAlign: TextAlign . right ,
) ,
textAlign: TextAlign . right ,
) ,
) ,
) ,
@ -410,9 +469,9 @@ class DisplayTrainOperator extends StatelessWidget {
child: Text (
trainData . operator ,
style: CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 14 ,
fontStyle: FontStyle . italic ,
) ,
fontSize: 14 ,
fontStyle: FontStyle . italic ,
) ,
) ,
) ,
) ;
@ -433,9 +492,9 @@ class DisplayTrainDeparture extends StatelessWidget {
/ / " Plecare în ${ dataPlecare . day . toString ( ) . padLeft ( 2 , ' 0 ' ) } . ${ dataPlecare . month . toString ( ) . padLeft ( 2 , ' 0 ' ) } . ${ dataPlecare . year . toString ( ) . padLeft ( 4 , ' 0 ' ) } " ,
" Plecare în ${ trainData . date } " ,
style: CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontStyle: FontStyle . italic ,
fontWeight: FontWeight . w200 ,
) ,
fontStyle: FontStyle . italic ,
fontWeight: FontWeight . w200 ,
) ,
textAlign: TextAlign . center ,
) ,
) ,
@ -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 (
@ -464,9 +525,9 @@ class DisplayTrainLastInfo extends StatelessWidget {
child: Text (
" Ultima informație " ,
style: CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 20 ,
fontWeight: FontWeight . bold ,
) ,
fontSize: 20 ,
fontWeight: FontWeight . bold ,
) ,
) ,
) ,
) ,
@ -480,10 +541,12 @@ class DisplayTrainLastInfo extends StatelessWidget {
textAlign: TextAlign . left ,
) ,
) ,
Expanded ( child: Container ( ) , ) ,
Expanded (
child: Container ( ) ,
) ,
Padding (
padding: const EdgeInsets . all ( 4 ) ,
child: Text (
child: Text (
stateToString ( trainData . status ! . state ) ,
style: CupertinoTheme . of ( context ) . textTheme . textStyle ,
textAlign: TextAlign . right ,
@ -510,20 +573,21 @@ class DisplayTrainLastInfo extends StatelessWidget {
if ( data > 0 ) {
return Text (
" $ data minute întârziere " ,
style: CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 14 ,
color: CupertinoColors . destructiveRed ,
) ,
" $ 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 (
fontSize: 12 ,
color: CupertinoColors . activeGreen ,
) ,
" ${ - data } ${ data = = - 1 ? ' minut ' : ' minute ' } mai devreme " ,
style:
CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 12 ,
color: CupertinoColors . activeGreen ,
) ,
) ;
}
} ,
@ -627,9 +691,9 @@ class DisplayTrainDestination extends StatelessWidget {
child: Text (
" Destinația " ,
style: CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 20 ,
fontWeight: FontWeight . bold ,
) ,
fontSize: 20 ,
fontWeight: FontWeight . bold ,
) ,
textAlign: TextAlign . center ,
) ,
) ,
@ -641,20 +705,22 @@ class DisplayTrainDestination extends StatelessWidget {
child: Text (
trainData . stations . last . name ,
style: CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 18 ,
fontWeight: FontWeight . w500 ,
) ,
fontSize: 18 ,
fontWeight: FontWeight . w500 ,
) ,
textAlign: TextAlign . center ,
) ,
) ,
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,26 +739,32 @@ class DisplayTrainDestination extends StatelessWidget {
children: [
TextSpan ( text: ' ' ) ,
TextSpan (
text: ' $ arrival ' ,
style: delay = = 0 ? null : TextStyle (
decoration: TextDecoration . lineThrough ,
) ,
text:
' ${ arrival . hour . toString ( ) . padLeft ( 2 , " 0 " ) } : ${ arrival . minute . toString ( ) . padLeft ( 2 , " 0 " ) } ' ,
style: delay = = 0
? null
: TextStyle (
decoration: TextDecoration . lineThrough ,
) ,
) ,
if ( delay ! = 0 ) . . . [
TextSpan ( text: ' ' ) ,
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 (
fontSize: 14 ,
) ,
style:
CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 14 ,
) ,
textAlign: TextAlign . center ,
) ,
] ,
@ -717,16 +789,16 @@ class DisplayTrainRouteDistance extends StatelessWidget {
Text (
" Distanța rutei " ,
style: CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 18 ,
fontWeight: FontWeight . bold ,
) ,
fontSize: 18 ,
fontWeight: FontWeight . bold ,
) ,
textAlign: TextAlign . center ,
) ,
Text (
" ${ trainData . stations . last . km } km " ,
style: CupertinoTheme . of ( context ) . textTheme . textStyle . copyWith (
fontSize: 16 ,
) ,
fontSize: 16 ,
) ,
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 (