|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import 'dart:math'; |
|
|
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
|
import 'package:flutter/gestures.dart'; |
|
|
|
|
import 'package:info_tren/components/cupertino_divider.dart'; |
|
|
|
|
import 'package:info_tren/components/sliver_persistent_header_padding.dart'; |
|
|
|
|
import 'package:info_tren/models/train_data.dart' hide State; |
|
|
|
@ -71,11 +72,13 @@ class TrainInfoCupertino extends StatelessWidget {
|
|
|
|
|
final TrainData trainData; |
|
|
|
|
final Future Function()? refresh; |
|
|
|
|
final bool? isRefreshing; |
|
|
|
|
final void Function()? onViewYesterdayTrain; |
|
|
|
|
|
|
|
|
|
TrainInfoCupertino({ |
|
|
|
|
required this.trainData, |
|
|
|
|
this.refresh, |
|
|
|
|
this.isRefreshing, |
|
|
|
|
this.onViewYesterdayTrain, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@ -259,6 +262,16 @@ class TrainInfoCupertino extends StatelessWidget {
|
|
|
|
|
color: FOREGROUND_WHITE, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (onViewYesterdayTrain != null && trainData.stations.first.departure!.scheduleTime.compareTo(DateTime.now()) > 0) ...[ |
|
|
|
|
SliverToBoxAdapter( |
|
|
|
|
child: DisplayTrainYesterdayWarningCupertino(onViewYesterdayTrain!), |
|
|
|
|
), |
|
|
|
|
SliverToBoxAdapter( |
|
|
|
|
child: CupertinoDivider( |
|
|
|
|
color: FOREGROUND_WHITE, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
DisplayTrainStations( |
|
|
|
|
trainData: trainData, |
|
|
|
|
), |
|
|
|
@ -586,7 +599,7 @@ class DisplayTrainLastInfo extends StatelessWidget {
|
|
|
|
|
style: |
|
|
|
|
CupertinoTheme.of(context).textTheme.textStyle.copyWith( |
|
|
|
|
fontSize: 12, |
|
|
|
|
color: CupertinoColors.activeGreen, |
|
|
|
|
color: CupertinoColors.systemGreen, |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -753,8 +766,8 @@ class DisplayTrainDestination extends StatelessWidget {
|
|
|
|
|
text: '$arrivalWithDelayString', |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: delay > 0 |
|
|
|
|
? CupertinoColors.destructiveRed |
|
|
|
|
: CupertinoColors.activeGreen, |
|
|
|
|
? CupertinoColors.systemRed |
|
|
|
|
: CupertinoColors.systemGreen, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
] |
|
|
|
@ -881,6 +894,39 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class DisplayTrainYesterdayWarningCupertino extends DisplayTrainYesterdayWarningCommon { |
|
|
|
|
DisplayTrainYesterdayWarningCupertino(void Function() onViewYesterdayTrain) : super(onViewYesterdayTrain); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return Column( |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
children: [ |
|
|
|
|
Padding( |
|
|
|
|
padding: const EdgeInsets.all(8.0), |
|
|
|
|
child: Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan(text: DisplayTrainYesterdayWarningCommon.trainDidNotDepart,), |
|
|
|
|
TextSpan(text: '\n'), |
|
|
|
|
TextSpan( |
|
|
|
|
text: DisplayTrainYesterdayWarningCommon.seeYesterdayTrain, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: CupertinoColors.link, |
|
|
|
|
), |
|
|
|
|
recognizer: TapGestureRecognizer() |
|
|
|
|
..onTap = onViewYesterdayTrain, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class DisplayTrainStations extends StatelessWidget { |
|
|
|
|
final TrainData trainData; |
|
|
|
|
|
|
|
|
|