@ -3,18 +3,24 @@ import 'package:flutter/material.dart';
import ' package:info_tren/components/slim_app_bar.dart ' ;
import ' package:info_tren/components/slim_app_bar.dart ' ;
import ' package:info_tren/models/train_data.dart ' hide State ;
import ' package:info_tren/models/train_data.dart ' hide State ;
import ' package:info_tren/models/ui_design.dart ' ;
import ' package:info_tren/models/ui_design.dart ' ;
import ' package:info_tren/pages/station_arrdep_page/view_station/view_station.dart ' ;
import ' package:info_tren/pages/train_info_page/view_train/train_info.dart ' ;
import ' package:info_tren/pages/train_info_page/view_train/train_info.dart ' ;
import ' package:info_tren/pages/train_info_page/view_train/train_info_material_DisplayTrainStation.dart ' ;
import ' package:info_tren/pages/train_info_page/view_train/train_info_material_DisplayTrainStation.dart ' ;
import ' package:info_tren/utils/state_to_string.dart ' ;
import ' package:info_tren/utils/state_to_string.dart ' ;
class TrainInfoLoadingMaterial extends TrainInfoLoading {
class TrainInfoLoadingMaterial extends TrainInfoLoading {
TrainInfoLoadingMaterial ( { required String title , String ? loadingText } ) : super ( title: title , loadingText: loadingText , uiDesign: UiDesign . MATERIAL ) ;
TrainInfoLoadingMaterial ( { required String title , String ? loadingText } )
: super (
title: title ,
loadingText: loadingText ,
uiDesign: UiDesign . MATERIAL ) ;
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return Scaffold (
return Scaffold (
appBar: AppBar (
appBar: AppBar (
title: Text ( title ) ,
title: Text ( title ) ,
centerTitle: true ,
) ,
) ,
body: Center (
body: Center (
child: loadingWidget ,
child: loadingWidget ,
@ -28,7 +34,11 @@ class TrainInfoErrorMaterial extends TrainInfoError {
required Object error ,
required Object error ,
required String title ,
required String title ,
Future Function ( ) ? refresh ,
Future Function ( ) ? refresh ,
} ) : super ( error: error , title: title , refresh: refresh , ) ;
} ) : super (
error: error ,
title: title ,
refresh: refresh ,
) ;
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
@ -56,24 +66,32 @@ class TrainInfoErrorMaterial extends TrainInfoError {
}
}
}
}
bool isSmallScreen ( BuildContext context ) = > MediaQuery . of ( context ) . size . height < = 425 ;
bool isSmallScreen ( BuildContext context ) = >
MediaQuery . of ( context ) . size . height < = 425 ;
class TrainInfoMaterial extends StatelessWidget {
class TrainInfoMaterial extends StatelessWidget {
final TrainData trainData ;
final TrainData trainData ;
final Future Function ( ) ? refresh ;
final Future Function ( ) ? refresh ;
final void Function ( ) ? onViewYesterdayTrain ;
final void Function ( ) ? onViewYesterdayTrain ;
TrainInfoMaterial ( { required this . trainData , this . refresh , this . onViewYesterdayTrain , } ) ;
TrainInfoMaterial ( {
required this . trainData ,
this . refresh ,
this . onViewYesterdayTrain ,
} ) ;
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return Builder (
return Builder (
builder: ( context ) {
builder: ( context ) {
return Scaffold (
return Scaffold (
appBar: isSmallScreen ( context ) ? null : AppBar (
appBar: isSmallScreen ( context )
centerTitle: true ,
? null
title: Text ( " Informații despre ${ trainData . rank } ${ trainData . number } " ) ,
: AppBar (
) ,
centerTitle: true ,
title: Text (
" Informații despre ${ trainData . rank } ${ trainData . number } " ) ,
) ,
body: Column (
body: Column (
children: < Widget > [
children: < Widget > [
if ( isSmallScreen ( context ) )
if ( isSmallScreen ( context ) )
@ -82,8 +100,8 @@ class TrainInfoMaterial extends StatelessWidget {
left: false ,
left: false ,
right: false ,
right: false ,
child: SlimAppBar (
child: SlimAppBar (
title: ' INFO TREN - ${ trainData . rank } ${ trainData . number } '
title:
) ,
' INFO TREN - ${ trainData . rank } ${ trainData . number } ' ) ,
) ,
) ,
Expanded (
Expanded (
child: SafeArea (
child: SafeArea (
@ -94,19 +112,27 @@ class TrainInfoMaterial extends StatelessWidget {
child: CustomScrollView (
child: CustomScrollView (
slivers: < Widget > [
slivers: < Widget > [
SliverToBoxAdapter (
SliverToBoxAdapter (
child: DisplayTrainID ( trainData: trainData , ) ,
child: DisplayTrainID (
trainData: trainData ,
) ,
) ,
) ,
SliverToBoxAdapter (
SliverToBoxAdapter (
child: DisplayTrainOperator ( trainData: trainData , ) ,
child: DisplayTrainOperator (
trainData: trainData ,
) ,
) ,
) ,
SliverPadding (
SliverPadding (
padding: const EdgeInsets . only ( left: 2 , right: 2 ) ,
padding: const EdgeInsets . only ( left: 2 , right: 2 ) ,
sliver: SliverToBoxAdapter (
sliver: SliverToBoxAdapter (
child: DisplayTrainRoute ( trainData: trainData , ) ,
child: DisplayTrainRoute (
trainData: trainData ,
) ,
) ,
) ,
) ,
) ,
SliverToBoxAdapter (
SliverToBoxAdapter (
child: DisplayTrainDeparture ( trainData: trainData , ) ,
child: DisplayTrainDeparture (
trainData: trainData ,
) ,
) ,
) ,
/ / SliverToBoxAdapter (
/ / SliverToBoxAdapter (
/ / child: Divider (
/ / child: Divider (
@ -115,7 +141,9 @@ class TrainInfoMaterial extends StatelessWidget {
/ / ) ,
/ / ) ,
/ / ) ,
/ / ) ,
SliverToBoxAdapter (
SliverToBoxAdapter (
child: DisplayTrainLastInfo ( trainData: trainData , ) ,
child: DisplayTrainLastInfo (
trainData: trainData ,
) ,
) ,
) ,
SliverToBoxAdapter (
SliverToBoxAdapter (
child: IntrinsicHeight (
child: IntrinsicHeight (
@ -123,8 +151,15 @@ class TrainInfoMaterial extends StatelessWidget {
children: < Widget > [
children: < Widget > [
/ / Expanded ( child: DisplayTrainNextStop ( trainData: trainData , ) ) ,
/ / Expanded ( child: DisplayTrainNextStop ( trainData: trainData , ) ) ,
/ / Expanded ( child: DisplayTrainDestination ( trainData: trainData , ) ) ,
/ / Expanded ( child: DisplayTrainDestination ( trainData: trainData , ) ) ,
Expanded ( child: DisplayTrainRouteDuration ( trainData: trainData , ) ) ,
Expanded (
Expanded ( child: DisplayTrainRouteDistance ( trainData: trainData , ) , ) ,
child: DisplayTrainRouteDuration (
trainData: trainData ,
) ) ,
Expanded (
child: DisplayTrainRouteDistance (
trainData: trainData ,
) ,
) ,
] ,
] ,
) ,
) ,
) ,
) ,
@ -146,9 +181,13 @@ class TrainInfoMaterial extends StatelessWidget {
height: isSmallScreen ( context ) ? 8 : 16 ,
height: isSmallScreen ( context ) ? 8 : 16 ,
) ,
) ,
) ,
) ,
if ( onViewYesterdayTrain ! = null & & trainData . stations . first . departure ! . scheduleTime . compareTo ( DateTime . now ( ) ) > 0 ) . . . [
if ( onViewYesterdayTrain ! = null & &
trainData . stations . first . departure ! . scheduleTime
. compareTo ( DateTime . now ( ) ) >
0 ) . . . [
SliverToBoxAdapter (
SliverToBoxAdapter (
child: DisplayTrainYesterdayWarningMaterial ( onViewYesterdayTrain ! ) ,
child: DisplayTrainYesterdayWarningMaterial (
onViewYesterdayTrain ! ) ,
) ,
) ,
SliverToBoxAdapter (
SliverToBoxAdapter (
child: Divider (
child: Divider (
@ -191,19 +230,24 @@ class DisplayTrainID extends StatelessWidget {
TextSpan (
TextSpan (
text: trainData . rank ,
text: trainData . rank ,
style: TextStyle (
style: TextStyle (
color: trainData . rank . startsWith ( ' IR ' ) ? Color . fromARGB ( 255 , 255 , 0 , 0 ) : null ,
color: trainData . rank . startsWith ( ' IR ' )
? Color . fromARGB ( 255 , 255 , 0 , 0 )
: null ,
) ,
) ,
) ,
) ,
TextSpan ( text: ' ' ) ,
TextSpan ( text: ' ' ) ,
TextSpan ( text: trainData . number , ) ,
TextSpan (
text: trainData . number ,
) ,
] ,
] ,
) ,
) ,
style: ( isSmallScreen ( context )
style: ( isSmallScreen ( context )
? Theme . of ( context ) . textTheme . headline4
? Theme . of ( context ) . textTheme . headline4
: Theme . of ( context ) . textTheme . headline3 ) ? . copyWith (
: Theme . of ( context ) . textTheme . headline3 )
color: Theme . of ( context ) . textTheme . bodyText2 ? . color ,
? . copyWith (
fontWeight: FontWeight . bold ,
color: Theme . of ( context ) . textTheme . bodyText2 ? . color ,
) ,
fontWeight: FontWeight . bold ,
) ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
) ;
) ;
}
}
@ -219,9 +263,9 @@ class DisplayTrainOperator extends StatelessWidget {
return Text (
return Text (
trainData . operator ,
trainData . operator ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontStyle: FontStyle . italic ,
fontStyle: FontStyle . italic ,
fontSize: isSmallScreen ( context ) ? 12 : 14 ,
fontSize: isSmallScreen ( context ) ? 12 : 14 ,
) ,
) ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
) ;
) ;
}
}
@ -243,8 +287,8 @@ class DisplayTrainRoute extends StatelessWidget {
child: Text (
child: Text (
trainData . route . from ,
trainData . route . from ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: 16 ,
fontSize: 16 ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
@ -257,8 +301,8 @@ class DisplayTrainRoute extends StatelessWidget {
child: Text (
child: Text (
trainData . route . to ,
trainData . route . to ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: 16 ,
fontSize: 16 ,
) ,
) ,
textAlign: TextAlign . right ,
textAlign: TextAlign . right ,
) ,
) ,
) ,
) ,
@ -282,10 +326,10 @@ 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 ${ dataPlecare . day . toString ( ) . padLeft ( 2 , ' 0 ' ) } . ${ dataPlecare . month . toString ( ) . padLeft ( 2 , ' 0 ' ) } . ${ dataPlecare . year . toString ( ) . padLeft ( 4 , ' 0 ' ) } " ,
" Plecare în ${ trainData . date } " ,
" Plecare în ${ trainData . date } " ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontStyle: FontStyle . italic ,
fontStyle: FontStyle . italic ,
fontWeight: FontWeight . w200 ,
fontWeight: FontWeight . w200 ,
fontSize: isSmallScreen ( context ) ? 14 : 16 ,
fontSize: isSmallScreen ( context ) ? 14 : 16 ,
) ,
) ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
) ,
) ,
) ;
) ;
@ -315,9 +359,9 @@ class DisplayTrainLastInfo extends StatelessWidget {
child: Text (
child: Text (
" Ultima informație " ,
" Ultima informație " ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: isSmallScreen ( context ) ? 20 : 22 ,
fontSize: isSmallScreen ( context ) ? 20 : 22 ,
fontWeight: FontWeight . bold ,
fontWeight: FontWeight . bold ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
@ -328,19 +372,21 @@ class DisplayTrainLastInfo extends StatelessWidget {
child: Text (
child: Text (
trainData . status ! . station ,
trainData . status ! . station ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: isSmallScreen ( context ) ? 16 : 18 ,
fontSize: isSmallScreen ( context ) ? 16 : 18 ,
) ,
) ,
textAlign: TextAlign . left ,
textAlign: TextAlign . left ,
) ,
) ,
) ,
) ,
Expanded ( child: Container ( ) , ) ,
Expanded (
child: Container ( ) ,
) ,
Padding (
Padding (
padding: const EdgeInsets . all ( 4 ) ,
padding: const EdgeInsets . all ( 4 ) ,
child: Text (
child: Text (
stateToString ( trainData . status ! . state ) ,
stateToString ( trainData . status ! . state ) ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: isSmallScreen ( context ) ? 16 : 18 ,
fontSize: isSmallScreen ( context ) ? 16 : 18 ,
) ,
) ,
textAlign: TextAlign . right ,
textAlign: TextAlign . right ,
) ,
) ,
) ,
) ,
@ -359,7 +405,9 @@ class DisplayTrainLastInfo extends StatelessWidget {
/ / ) ;
/ / ) ;
/ / } ,
/ / } ,
/ / ) ,
/ / ) ,
Expanded ( child: Container ( ) , ) ,
Expanded (
child: Container ( ) ,
) ,
Builder (
Builder (
builder: ( context ) {
builder: ( context ) {
final data = trainData . status ! . delay ;
final data = trainData . status ! . delay ;
@ -370,19 +418,20 @@ class DisplayTrainLastInfo extends StatelessWidget {
if ( data > 0 ) {
if ( data > 0 ) {
return Text (
return Text (
" $ data ${ data = = 1 ? ' minut ' : ' minute ' } întârziere " ,
" $ data ${ data = = 1 ? ' minut ' : ' minute ' } întârziere " ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style:
fontSize: isSmallScreen ( context ) ? 14 : 16 ,
Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
color: Colors . red . shade300 ,
fontSize: isSmallScreen ( context ) ? 14 : 16 ,
) ,
color: Colors . red . shade300 ,
) ,
) ;
) ;
}
} else {
else {
return Text (
return Text (
" ${ - data } ${ data = = - 1 ? ' minut ' : ' minute ' } mai devreme " ,
" ${ - data } ${ data = = - 1 ? ' minut ' : ' minute ' } mai devreme " ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style:
fontSize: isSmallScreen ( context ) ? 14 : 16 ,
Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
color: Colors . green . shade300 ,
fontSize: isSmallScreen ( context ) ? 14 : 16 ,
) ,
color: Colors . green . shade300 ,
) ,
) ;
) ;
}
}
} ,
} ,
@ -500,9 +549,9 @@ class DisplayTrainDestination extends StatelessWidget {
child: Text (
child: Text (
" Destinația " ,
" Destinația " ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: isSmallScreen ( context ) ? 20 : 22 ,
fontSize: isSmallScreen ( context ) ? 20 : 22 ,
fontWeight: FontWeight . bold ,
fontWeight: FontWeight . bold ,
) ,
) ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
) ,
) ,
) ,
) ,
@ -511,18 +560,21 @@ class DisplayTrainDestination extends StatelessWidget {
child: Text (
child: Text (
destination . name ,
destination . name ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: isSmallScreen ( context ) ? 18 : 20 ,
fontSize: isSmallScreen ( context ) ? 18 : 20 ,
fontWeight: FontWeight . w500 ,
fontWeight: FontWeight . w500 ,
) ,
) ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
) ,
) ,
) ,
) ,
Builder (
Builder (
builder: ( context ) {
builder: ( context ) {
final arrival = destination . arrival ! . scheduleTime . toLocal ( ) ;
final arrival = destination . arrival ! . scheduleTime . toLocal ( ) ;
final delay = trainData . stations . last . arrival ! . status ? . delay ? ? 0 ;
final delay =
final arrivalWithDelay = arrival . add ( Duration ( minutes: delay ) ) ;
trainData . stations . last . arrival ! . status ? . delay ? ? 0 ;
final arrivalWithDelayString = ' ${ arrivalWithDelay . hour } : ${ arrivalWithDelay . minute . toString ( ) . padLeft ( 2 , " 0 " ) } ' ;
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 " ] ;
/ / const months = [ " ian " , " feb " , " mar " , " apr " , " mai " , " iun " , " iul " , " aug " , " sep " , " oct " , " noi " , " dec " ] ;
return Column (
return Column (
@ -542,25 +594,30 @@ class DisplayTrainDestination extends StatelessWidget {
children: [
children: [
TextSpan ( text: ' ' ) ,
TextSpan ( text: ' ' ) ,
TextSpan (
TextSpan (
text: ' ${ arrival . hour . toString ( ) . padLeft ( 2 , ' 0 ' ) } : ${ arrival . minute . toString ( ) . padLeft ( 2 , ' 0 ' ) } ' ,
text:
style: delay = = 0 ? null : TextStyle (
' ${ arrival . hour . toString ( ) . padLeft ( 2 , ' 0 ' ) } : ${ arrival . minute . toString ( ) . padLeft ( 2 , ' 0 ' ) } ' ,
decoration: TextDecoration . lineThrough ,
style: delay = = 0
) ,
? null
: TextStyle (
decoration: TextDecoration . lineThrough ,
) ,
) ,
) ,
if ( delay ! = 0 ) . . . [
if ( delay ! = 0 ) . . . [
TextSpan ( text: ' ' ) ,
TextSpan ( text: ' ' ) ,
TextSpan (
TextSpan (
text: ' $ arrivalWithDelayString ' ,
text: ' $ arrivalWithDelayString ' ,
style: TextStyle (
style: TextStyle (
color: delay > 0 ? Colors . red . shade300 : Colors . green . shade300 ,
color: delay > 0
? Colors . red . shade300
: Colors . green . shade300 ,
) ,
) ,
) ,
) ,
]
]
] ,
] ,
) ,
) ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: isSmallScreen ( context ) ? 14 : 16 ,
fontSize: isSmallScreen ( context ) ? 14 : 16 ,
) ,
) ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
) ,
) ,
] ,
] ,
@ -592,16 +649,16 @@ class DisplayTrainRouteDistance extends StatelessWidget {
Text (
Text (
" Distanța rutei " ,
" Distanța rutei " ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: isSmallScreen ( context ) ? 20 : 22 ,
fontSize: isSmallScreen ( context ) ? 20 : 22 ,
fontWeight: FontWeight . bold ,
fontWeight: FontWeight . bold ,
) ,
) ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
) ,
) ,
Text (
Text (
" ${ trainData . stations . last . km } km " ,
" ${ trainData . stations . last . km } km " ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: isSmallScreen ( context ) ? 18 : 20 ,
fontSize: isSmallScreen ( context ) ? 18 : 20 ,
) ,
) ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
) ,
) ,
] ,
] ,
@ -629,22 +686,26 @@ class DisplayTrainRouteDuration extends StatelessWidget {
Text (
Text (
" Durata rutei " ,
" Durata rutei " ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: isSmallScreen ( context ) ? 20 : 22 ,
fontSize: isSmallScreen ( context ) ? 20 : 22 ,
fontWeight: FontWeight . bold ,
fontWeight: FontWeight . bold ,
) ,
) ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
) ,
) ,
Builder (
Builder (
builder: ( context ) {
builder: ( context ) {
var duration = trainData . stations . last . arrival ! . scheduleTime . difference ( trainData . stations . first . departure ! . scheduleTime ) ;
var duration = trainData . stations . last . arrival ! . scheduleTime
. difference (
trainData . stations . first . departure ! . scheduleTime ) ;
var durationString = StringBuffer ( ) ;
var durationString = StringBuffer ( ) ;
bool firstWritten = false ;
bool firstWritten = false ;
if ( duration . inDays > 0 ) {
if ( duration . inDays > 0 ) {
firstWritten = true ;
firstWritten = true ;
if ( duration . inDays = = 1 ) durationString . write ( " 1 zi " ) ;
if ( duration . inDays = = 1 )
else durationString . write ( " ${ duration . inDays } zile " ) ;
durationString . write ( " 1 zi " ) ;
else
durationString . write ( " ${ duration . inDays } zile " ) ;
duration - = Duration ( days: duration . inDays ) ;
duration - = Duration ( days: duration . inDays ) ;
}
}
@ -653,8 +714,10 @@ class DisplayTrainRouteDuration extends StatelessWidget {
durationString . write ( " , " ) ;
durationString . write ( " , " ) ;
}
}
firstWritten = true ;
firstWritten = true ;
if ( duration . inHours = = 1 ) durationString . write ( " 1 oră " ) ;
if ( duration . inHours = = 1 )
else durationString . write ( " ${ duration . inHours } ore " ) ;
durationString . write ( " 1 oră " ) ;
else
durationString . write ( " ${ duration . inHours } ore " ) ;
duration - = Duration ( hours: duration . inHours ) ;
duration - = Duration ( hours: duration . inHours ) ;
}
}
@ -663,16 +726,18 @@ class DisplayTrainRouteDuration extends StatelessWidget {
durationString . write ( " , " ) ;
durationString . write ( " , " ) ;
}
}
firstWritten = true ;
firstWritten = true ;
if ( duration . inMinutes = = 1 ) durationString . write ( " 1 minut " ) ;
if ( duration . inMinutes = = 1 )
else durationString . write ( " ${ duration . inMinutes } minute " ) ;
durationString . write ( " 1 minut " ) ;
else
durationString . write ( " ${ duration . inMinutes } minute " ) ;
duration - = Duration ( minutes: duration . inMinutes ) ;
duration - = Duration ( minutes: duration . inMinutes ) ;
}
}
return Text (
return Text (
durationString . toString ( ) ,
durationString . toString ( ) ,
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
style: Theme . of ( context ) . textTheme . bodyText2 ? . copyWith (
fontSize: isSmallScreen ( context ) ? 18 : 20 ,
fontSize: isSmallScreen ( context ) ? 18 : 20 ,
) ,
) ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
) ;
) ;
} ,
} ,
@ -685,8 +750,10 @@ class DisplayTrainRouteDuration extends StatelessWidget {
}
}
}
}
class DisplayTrainYesterdayWarningMaterial extends DisplayTrainYesterdayWarningCommon {
class DisplayTrainYesterdayWarningMaterial
DisplayTrainYesterdayWarningMaterial ( void Function ( ) onViewYesterdayTrain ) : super ( onViewYesterdayTrain ) ;
extends DisplayTrainYesterdayWarningCommon {
DisplayTrainYesterdayWarningMaterial ( void Function ( ) onViewYesterdayTrain )
: super ( onViewYesterdayTrain ) ;
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
@ -698,7 +765,9 @@ class DisplayTrainYesterdayWarningMaterial extends DisplayTrainYesterdayWarningC
child: Text . rich (
child: Text . rich (
TextSpan (
TextSpan (
children: [
children: [
TextSpan ( text: DisplayTrainYesterdayWarningCommon . trainDidNotDepart , ) ,
TextSpan (
text: DisplayTrainYesterdayWarningCommon . trainDidNotDepart ,
) ,
TextSpan ( text: ' \n ' ) ,
TextSpan ( text: ' \n ' ) ,
TextSpan (
TextSpan (
text: DisplayTrainYesterdayWarningCommon . seeYesterdayTrain ,
text: DisplayTrainYesterdayWarningCommon . seeYesterdayTrain ,
@ -730,6 +799,12 @@ class DisplayTrainStations extends StatelessWidget {
return IndexedSemantics (
return IndexedSemantics (
child: DisplayTrainStation (
child: DisplayTrainStation (
station: trainData . stations [ index ] ,
station: trainData . stations [ index ] ,
onTap: ( ) {
Navigator . of ( context ) . pushNamed (
ViewStationPage . routeName ,
arguments: trainData . stations [ index ] . name ,
) ;
} ,
) ,
) ,
index: index ,
index: index ,
) ;
) ;
@ -740,4 +815,3 @@ class DisplayTrainStations extends StatelessWidget {
) ;
) ;
}
}
}
}