dart fix
This commit is contained in:
parent
6b33fcb01c
commit
2ac04cba02
31 changed files with 274 additions and 273 deletions
|
@ -56,7 +56,7 @@ class MaterialBadge extends StatelessWidget {
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
text,
|
text,
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 16 : 20,
|
fontSize: isSmallScreen(context) ? 16 : 20,
|
||||||
fontWeight: MediaQuery.of(context).boldText ? FontWeight.w400 : FontWeight.w200,
|
fontWeight: MediaQuery.of(context).boldText ? FontWeight.w400 : FontWeight.w200,
|
||||||
color: MediaQuery.of(context).boldText ? Colors.white70 : foregroundColor,
|
color: MediaQuery.of(context).boldText ? Colors.white70 : foregroundColor,
|
||||||
|
@ -67,7 +67,7 @@ class MaterialBadge extends StatelessWidget {
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
caption,
|
caption,
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
color: MediaQuery.of(context).boldText ? Colors.white70 : foregroundColor,
|
color: MediaQuery.of(context).boldText ? Colors.white70 : foregroundColor,
|
||||||
),
|
),
|
||||||
|
@ -86,7 +86,7 @@ class CupertinoBadge extends StatelessWidget {
|
||||||
final bool isOnTime;
|
final bool isOnTime;
|
||||||
final bool isDelayed;
|
final bool isDelayed;
|
||||||
|
|
||||||
CupertinoBadge({
|
const CupertinoBadge({
|
||||||
required this.text,
|
required this.text,
|
||||||
required this.caption,
|
required this.caption,
|
||||||
this.isNotScheduled = false,
|
this.isNotScheduled = false,
|
||||||
|
@ -100,16 +100,16 @@ class CupertinoBadge extends StatelessWidget {
|
||||||
Color? backgroundColor;
|
Color? backgroundColor;
|
||||||
|
|
||||||
if (isNotScheduled) {
|
if (isNotScheduled) {
|
||||||
foregroundColor = Color.fromRGBO(225, 175, 30, 1);
|
foregroundColor = const Color.fromRGBO(225, 175, 30, 1);
|
||||||
backgroundColor = Color.fromRGBO(80, 40, 10, 1);
|
backgroundColor = const Color.fromRGBO(80, 40, 10, 1);
|
||||||
}
|
}
|
||||||
else if (isOnTime) {
|
else if (isOnTime) {
|
||||||
foregroundColor = Color.fromRGBO(130, 175, 65, 1);
|
foregroundColor = const Color.fromRGBO(130, 175, 65, 1);
|
||||||
backgroundColor = Color.fromRGBO(40, 80, 10, 1);
|
backgroundColor = const Color.fromRGBO(40, 80, 10, 1);
|
||||||
}
|
}
|
||||||
else if (isDelayed) {
|
else if (isDelayed) {
|
||||||
foregroundColor = Color.fromRGBO(225, 75, 30, 1);
|
foregroundColor = const Color.fromRGBO(225, 75, 30, 1);
|
||||||
backgroundColor = Color.fromRGBO(80, 20, 10, 1);
|
backgroundColor = const Color.fromRGBO(80, 20, 10, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
|
|
|
@ -4,7 +4,7 @@ import 'package:info_tren/pages/train_info_page/train_info_constants.dart';
|
||||||
class CupertinoDivider extends StatelessWidget {
|
class CupertinoDivider extends StatelessWidget {
|
||||||
final Color color;
|
final Color color;
|
||||||
|
|
||||||
CupertinoDivider({Key? key, Color? color}):
|
const CupertinoDivider({Key? key, Color? color}):
|
||||||
color = color ?? FOREGROUND_DARK_GREY,
|
color = color ?? FOREGROUND_DARK_GREY,
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class CupertinoDivider extends StatelessWidget {
|
||||||
class CupertinoVerticalDivider extends StatelessWidget {
|
class CupertinoVerticalDivider extends StatelessWidget {
|
||||||
final Color color;
|
final Color color;
|
||||||
|
|
||||||
CupertinoVerticalDivider({Key? key, Color? color}):
|
const CupertinoVerticalDivider({Key? key, Color? color}):
|
||||||
color = color ?? FOREGROUND_DARK_GREY,
|
color = color ?? FOREGROUND_DARK_GREY,
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ class CupertinoListTile extends StatelessWidget {
|
||||||
title!,
|
title!,
|
||||||
if (subtitle != null)
|
if (subtitle != null)
|
||||||
CupertinoTheme(
|
CupertinoTheme(
|
||||||
child: subtitle!,
|
|
||||||
data: CupertinoTheme.of(context).copyWith(
|
data: CupertinoTheme.of(context).copyWith(
|
||||||
textTheme: CupertinoTextThemeData(
|
textTheme: CupertinoTextThemeData(
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
|
@ -31,6 +30,7 @@ class CupertinoListTile extends StatelessWidget {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
child: subtitle!,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -9,7 +9,7 @@ class FutureDisplay<T> extends StatelessWidget {
|
||||||
final Widget Function<T>(BuildContext context, T data) builder;
|
final Widget Function<T>(BuildContext context, T data) builder;
|
||||||
final Widget Function(BuildContext context, Object error, StackTrace? st)? errorBuilder;
|
final Widget Function(BuildContext context, Object error, StackTrace? st)? errorBuilder;
|
||||||
|
|
||||||
FutureDisplay({Key? key, required this.future, required this.builder, this.errorBuilder, this.uiDesign}): super(key: key);
|
const FutureDisplay({Key? key, required this.future, required this.builder, this.errorBuilder, this.uiDesign}): super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -24,10 +24,10 @@ class FutureDisplay<T> extends StatelessWidget {
|
||||||
Widget loadingWidget;
|
Widget loadingWidget;
|
||||||
switch (uiDesign) {
|
switch (uiDesign) {
|
||||||
case UiDesign.MATERIAL:
|
case UiDesign.MATERIAL:
|
||||||
loadingWidget = CircularProgressIndicator();
|
loadingWidget = const CircularProgressIndicator();
|
||||||
break;
|
break;
|
||||||
case UiDesign.CUPERTINO:
|
case UiDesign.CUPERTINO:
|
||||||
loadingWidget = CupertinoActivityIndicator();
|
loadingWidget = const CupertinoActivityIndicator();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw UnmatchedUiDesignException(uiDesign);
|
throw UnmatchedUiDesignException(uiDesign);
|
||||||
|
|
|
@ -27,5 +27,5 @@ class Loading extends StatelessWidget {
|
||||||
|
|
||||||
abstract class LoadingCommon extends StatelessWidget {
|
abstract class LoadingCommon extends StatelessWidget {
|
||||||
final String text;
|
final String text;
|
||||||
LoadingCommon({required this.text});
|
const LoadingCommon({required this.text});
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:info_tren/components/loading/loading.dart';
|
import 'package:info_tren/components/loading/loading.dart';
|
||||||
|
|
||||||
class LoadingCupertino extends LoadingCommon {
|
class LoadingCupertino extends LoadingCommon {
|
||||||
LoadingCupertino({required String text}) : super(text: text,);
|
const LoadingCupertino({required String text}) : super(text: text,);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -11,8 +11,8 @@ class LoadingCupertino extends LoadingCommon {
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
const Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: EdgeInsets.all(8.0),
|
||||||
child: CupertinoActivityIndicator(),
|
child: CupertinoActivityIndicator(),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
|
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:info_tren/components/loading/loading.dart';
|
import 'package:info_tren/components/loading/loading.dart';
|
||||||
|
|
||||||
class LoadingMaterial extends LoadingCommon {
|
class LoadingMaterial extends LoadingCommon {
|
||||||
LoadingMaterial({required String text}) : super(text: text,);
|
const LoadingMaterial({required String text}) : super(text: text,);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -11,8 +11,8 @@ class LoadingMaterial extends LoadingCommon {
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
const Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: EdgeInsets.all(8.0),
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
|
|
@ -19,7 +19,7 @@ class _RefreshFutureBuilderState<T> extends State<RefreshFutureBuilder<T>> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
snapshot = widget.initialData != null ? RefreshFutureBuilderSnapshot.initial(widget.initialData!) : RefreshFutureBuilderSnapshot.nothing();
|
snapshot = widget.initialData != null ? RefreshFutureBuilderSnapshot.initial(widget.initialData as T) : const RefreshFutureBuilderSnapshot.nothing();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -39,7 +39,7 @@ class _RefreshFutureBuilderState<T> extends State<RefreshFutureBuilder<T>> {
|
||||||
setState(() {
|
setState(() {
|
||||||
switch (snapshot.state) {
|
switch (snapshot.state) {
|
||||||
case RefreshFutureBuilderState.none:
|
case RefreshFutureBuilderState.none:
|
||||||
snapshot = RefreshFutureBuilderSnapshot.waiting();
|
snapshot = const RefreshFutureBuilderSnapshot.waiting();
|
||||||
break;
|
break;
|
||||||
case RefreshFutureBuilderState.initial:
|
case RefreshFutureBuilderState.initial:
|
||||||
snapshot = RefreshFutureBuilderSnapshot.refresh(snapshot.data);
|
snapshot = RefreshFutureBuilderSnapshot.refresh(snapshot.data);
|
||||||
|
@ -47,7 +47,7 @@ class _RefreshFutureBuilderState<T> extends State<RefreshFutureBuilder<T>> {
|
||||||
case RefreshFutureBuilderState.waiting:
|
case RefreshFutureBuilderState.waiting:
|
||||||
return;
|
return;
|
||||||
case RefreshFutureBuilderState.error:
|
case RefreshFutureBuilderState.error:
|
||||||
snapshot = RefreshFutureBuilderSnapshot.waiting();
|
snapshot = const RefreshFutureBuilderSnapshot.waiting();
|
||||||
break;
|
break;
|
||||||
case RefreshFutureBuilderState.done:
|
case RefreshFutureBuilderState.done:
|
||||||
snapshot = RefreshFutureBuilderSnapshot.refresh(snapshot.data);
|
snapshot = RefreshFutureBuilderSnapshot.refresh(snapshot.data);
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions_cupertino.dart';
|
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions_cupertino.dart';
|
||||||
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions_material.dart';
|
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions_material.dart';
|
||||||
import 'package:info_tren/models.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/utils/default_ui_design.dart';
|
import 'package:info_tren/utils/default_ui_design.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
|
||||||
|
|
||||||
class SelectTrainSuggestions extends StatefulWidget {
|
class SelectTrainSuggestions extends StatefulWidget {
|
||||||
final UiDesign? uiDesign;
|
final UiDesign? uiDesign;
|
||||||
|
@ -95,7 +93,7 @@ class OperatorAutocompleteSliver extends StatelessWidget {
|
||||||
return SliverPrototypeExtentList(
|
return SliverPrototypeExtentList(
|
||||||
prototypeItem: Column(
|
prototypeItem: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
mapTrainToItem(TrainsResult(company: 'Company', number: '123', rank: 'R')),
|
mapTrainToItem(const TrainsResult(company: 'Company', number: '123', rank: 'R')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
|
|
@ -21,14 +21,14 @@ class SelectTrainSuggestionsStateCupertino extends SelectTrainSuggestionsState {
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
CupertinoDivider(),
|
const CupertinoDivider(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class OperatorAutocompleteTileCupertino extends OperatorAutocompleteTile {
|
class OperatorAutocompleteTileCupertino extends OperatorAutocompleteTile {
|
||||||
OperatorAutocompleteTileCupertino({
|
const OperatorAutocompleteTileCupertino({
|
||||||
Key? key,
|
Key? key,
|
||||||
required String operatorName,
|
required String operatorName,
|
||||||
required void Function(String) onTrainSelected,
|
required void Function(String) onTrainSelected,
|
||||||
|
@ -71,7 +71,7 @@ class OperatorAutocompleteTileCupertino extends OperatorAutocompleteTile {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
CupertinoDivider(),
|
const CupertinoDivider(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,14 @@ class SelectTrainSuggestionsStateMaterial extends SelectTrainSuggestionsState {
|
||||||
onTrainSelected(currentInput);
|
onTrainSelected(currentInput);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Divider(),
|
const Divider(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class OperatorAutocompleteTileMaterial extends OperatorAutocompleteTile {
|
class OperatorAutocompleteTileMaterial extends OperatorAutocompleteTile {
|
||||||
OperatorAutocompleteTileMaterial({
|
const OperatorAutocompleteTileMaterial({
|
||||||
Key? key,
|
Key? key,
|
||||||
required String operatorName,
|
required String operatorName,
|
||||||
required void Function(String) onTrainSelected,
|
required void Function(String) onTrainSelected,
|
||||||
|
|
|
@ -5,7 +5,7 @@ class SlimAppBar extends StatelessWidget {
|
||||||
final double size;
|
final double size;
|
||||||
// final Function onBackTap;
|
// final Function onBackTap;
|
||||||
|
|
||||||
SlimAppBar({
|
const SlimAppBar({
|
||||||
required this.title,
|
required this.title,
|
||||||
this.size = 24,
|
this.size = 24,
|
||||||
// this.onBackTap,
|
// this.onBackTap,
|
||||||
|
@ -28,11 +28,11 @@ class SlimAppBar extends StatelessWidget {
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
SizedBox(
|
||||||
height: size,
|
height: size,
|
||||||
width: size,
|
width: size,
|
||||||
child: (ModalRoute.of(context)?.canPop ?? false)
|
child: (ModalRoute.of(context)?.canPop ?? false)
|
||||||
? BackButtonIcon()
|
? const BackButtonIcon()
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -43,13 +43,13 @@ class SlimAppBar extends StatelessWidget {
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style:
|
style:
|
||||||
Theme.of(context).appBarTheme.textTheme?.caption?.copyWith(color: Theme.of(context).appBarTheme.textTheme?.bodyText2?.color) ??
|
Theme.of(context).appBarTheme.textTheme?.bodySmall?.copyWith(color: Theme.of(context).appBarTheme.textTheme?.bodyMedium?.color) ??
|
||||||
Theme.of(context).textTheme.caption?.copyWith(color: Theme.of(context).textTheme.bodyText2?.color),
|
Theme.of(context).textTheme.bodySmall?.copyWith(color: Theme.of(context).textTheme.bodyMedium?.color),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
SizedBox(
|
||||||
height: size,
|
height: size,
|
||||||
width: size,
|
width: size,
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import 'dart:io' show Platform;
|
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:info_tren/models.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/pages/about/about_page.dart';
|
import 'package:info_tren/pages/about/about_page.dart';
|
||||||
|
|
|
@ -99,9 +99,9 @@ class Station {
|
||||||
: StationArrDepTime.fromJson(json["departure"]),
|
: StationArrDepTime.fromJson(json["departure"]),
|
||||||
km: json["km"],
|
km: json["km"],
|
||||||
name: json["name"],
|
name: json["name"],
|
||||||
platform: json["platform"] == null ? null : json["platform"],
|
platform: json["platform"],
|
||||||
stoppingTime:
|
stoppingTime:
|
||||||
json["stoppingTime"] == null ? null : json["stoppingTime"],
|
json["stoppingTime"],
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
|
@ -109,8 +109,8 @@ class Station {
|
||||||
"departure": departure?.toJson(),
|
"departure": departure?.toJson(),
|
||||||
"km": km,
|
"km": km,
|
||||||
"name": name,
|
"name": name,
|
||||||
"platform": platform == null ? null : platform,
|
"platform": platform,
|
||||||
"stoppingTime": stoppingTime == null ? null : stoppingTime,
|
"stoppingTime": stoppingTime,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,9 +221,7 @@ class EnumValues<T> {
|
||||||
EnumValues(this.map);
|
EnumValues(this.map);
|
||||||
|
|
||||||
Map<T, String> get reverse {
|
Map<T, String> get reverse {
|
||||||
if (reverseMap == null) {
|
reverseMap ??= map.map((k, v) => MapEntry(v, k));
|
||||||
reverseMap = map.map((k, v) => new MapEntry(v, k));
|
|
||||||
}
|
|
||||||
return reverseMap!;
|
return reverseMap!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,14 @@ class AboutPageStateCupertino extends AboutPageState {
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
packageInfo!.packageName,
|
packageInfo!.packageName,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
inherit: true,
|
inherit: true,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
const Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
padding: EdgeInsets.symmetric(vertical: 8.0),
|
||||||
child: CupertinoDivider(),
|
child: CupertinoDivider(),
|
||||||
),
|
),
|
||||||
for (final log in mergedChangelogs) ...[
|
for (final log in mergedChangelogs) ...[
|
||||||
|
@ -50,7 +50,7 @@ class AboutPageStateCupertino extends AboutPageState {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
log.version.toString(),
|
log.version.toString(),
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
inherit: true,
|
inherit: true,
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
),
|
),
|
||||||
|
@ -69,7 +69,7 @@ class AboutPageStateCupertino extends AboutPageState {
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Text(
|
child: Text(
|
||||||
currentVersionText,
|
currentVersionText,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
inherit: true,
|
inherit: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -88,7 +88,7 @@ class AboutPageStateCupertino extends AboutPageState {
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Text(
|
child: Text(
|
||||||
latestVersionText,
|
latestVersionText,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
inherit: true,
|
inherit: true,
|
||||||
color: CupertinoColors.activeGreen,
|
color: CupertinoColors.activeGreen,
|
||||||
),
|
),
|
||||||
|
@ -97,7 +97,7 @@ class AboutPageStateCupertino extends AboutPageState {
|
||||||
),
|
),
|
||||||
if (AboutPageState.DOWNLOAD == 'apk' && log.apkLink != null)
|
if (AboutPageState.DOWNLOAD == 'apk' && log.apkLink != null)
|
||||||
CupertinoButton(
|
CupertinoButton(
|
||||||
padding: EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
minSize: 0,
|
minSize: 0,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
launchUrl(
|
launchUrl(
|
||||||
|
@ -105,7 +105,7 @@ class AboutPageStateCupertino extends AboutPageState {
|
||||||
mode: LaunchMode.externalApplication,
|
mode: LaunchMode.externalApplication,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Icon(CupertinoIcons.arrow_down_circle),
|
child: const Icon(CupertinoIcons.arrow_down_circle),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -118,7 +118,7 @@ class AboutPageStateCupertino extends AboutPageState {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
CupertinoDivider(),
|
const CupertinoDivider(),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:flutter/gestures.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:info_tren/pages/about/about_page.dart';
|
import 'package:info_tren/pages/about/about_page.dart';
|
||||||
|
@ -27,14 +26,14 @@ class AboutPageStateMaterial extends AboutPageState {
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
packageInfo!.packageName,
|
packageInfo!.packageName,
|
||||||
style: Theme.of(context).textTheme.caption,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// ListTile(
|
// ListTile(
|
||||||
// title: Text(versionTitleText),
|
// title: Text(versionTitleText),
|
||||||
// subtitle: localChangelog.isEmpty ? null : Text(localChangelog.first.title),
|
// subtitle: localChangelog.isEmpty ? null : Text(localChangelog.first.title),
|
||||||
// ),
|
// ),
|
||||||
Divider(),
|
const Divider(),
|
||||||
for (final log in mergedChangelogs) ...[
|
for (final log in mergedChangelogs) ...[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
|
||||||
|
@ -44,7 +43,7 @@ class AboutPageStateMaterial extends AboutPageState {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
log.version.toString(),
|
log.version.toString(),
|
||||||
style: Theme.of(context).textTheme.headline4,
|
style: Theme.of(context).textTheme.headlineMedium,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (localChangelog.isNotEmpty && log.version == localChangelog.first.version)
|
if (localChangelog.isNotEmpty && log.version == localChangelog.first.version)
|
||||||
|
@ -60,7 +59,7 @@ class AboutPageStateMaterial extends AboutPageState {
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Text(
|
child: Text(
|
||||||
currentVersionText,
|
currentVersionText,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
inherit: true,
|
inherit: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -79,7 +78,7 @@ class AboutPageStateMaterial extends AboutPageState {
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Text(
|
child: Text(
|
||||||
latestVersionText,
|
latestVersionText,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
inherit: true,
|
inherit: true,
|
||||||
color: Colors.green,
|
color: Colors.green,
|
||||||
),
|
),
|
||||||
|
@ -90,13 +89,13 @@ class AboutPageStateMaterial extends AboutPageState {
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onSecondaryTap: () {
|
onSecondaryTap: () {
|
||||||
Clipboard.setData(ClipboardData(text: log.apkLink!.toString()));
|
Clipboard.setData(ClipboardData(text: log.apkLink!.toString()));
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||||
content: Text('Link copied to clipboard'),
|
content: Text('Link copied to clipboard'),
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
Clipboard.setData(ClipboardData(text: log.apkLink!.toString()));
|
Clipboard.setData(ClipboardData(text: log.apkLink!.toString()));
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||||
content: Text('Link copied to clipboard'),
|
content: Text('Link copied to clipboard'),
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
|
@ -107,10 +106,10 @@ class AboutPageStateMaterial extends AboutPageState {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
child: Tooltip(
|
child: const Tooltip(
|
||||||
message: 'Download APK',
|
message: 'Download APK',
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(4),
|
padding: EdgeInsets.all(4),
|
||||||
child: Icon(Icons.download),
|
child: Icon(Icons.download),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -8,7 +8,6 @@ class MainPageCupertino extends MainPageShared {
|
||||||
navigationBar: CupertinoNavigationBar(
|
navigationBar: CupertinoNavigationBar(
|
||||||
middle: Text(pageTitle),
|
middle: Text(pageTitle),
|
||||||
trailing: CupertinoButton(
|
trailing: CupertinoButton(
|
||||||
child: Icon(CupertinoIcons.ellipsis_circle),
|
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showCupertinoModalPopup(
|
showCupertinoModalPopup(
|
||||||
|
@ -26,12 +25,13 @@ class MainPageCupertino extends MainPageShared {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
child: Text('Anulare'),
|
child: const Text('Anulare'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
child: const Icon(CupertinoIcons.ellipsis_circle),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
|
@ -39,15 +39,16 @@ class MainPageCupertino extends MainPageShared {
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: options.map((option) => CupertinoButton.filled(
|
children: options.map((option) => CupertinoButton.filled(
|
||||||
|
onPressed: option.action == null ? null : () => option.action!(context),
|
||||||
child: Text.rich(
|
child: Text.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
TextSpan(text: option.name),
|
TextSpan(text: option.name),
|
||||||
if (option.description != null) ...[
|
if (option.description != null) ...[
|
||||||
TextSpan(text: '\n'),
|
const TextSpan(text: '\n'),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: option.description,
|
text: option.description,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
inherit: true,
|
inherit: true,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
|
@ -57,7 +58,6 @@ class MainPageCupertino extends MainPageShared {
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
onPressed: option.action == null ? null : () => option.action!(context),
|
|
||||||
)).map((w) => Padding(
|
)).map((w) => Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(4, 2, 4, 2),
|
padding: const EdgeInsets.fromLTRB(4, 2, 4, 2),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
|
|
@ -10,11 +10,11 @@ class MainPageMaterial extends MainPageShared {
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
actions: [
|
actions: [
|
||||||
PopupMenuButton<int>(
|
PopupMenuButton<int>(
|
||||||
icon: Icon(Icons.more_vert),
|
icon: const Icon(Icons.more_vert),
|
||||||
tooltip: moreOptionsText,
|
tooltip: moreOptionsText,
|
||||||
itemBuilder: (_) => popupMenu.asMap().entries.map((e) => PopupMenuItem(
|
itemBuilder: (_) => popupMenu.asMap().entries.map((e) => PopupMenuItem(
|
||||||
child: Text(e.value.name),
|
|
||||||
value: e.key,
|
value: e.key,
|
||||||
|
child: Text(e.value.name),
|
||||||
)).toList(),
|
)).toList(),
|
||||||
onSelected: (index) {
|
onSelected: (index) {
|
||||||
popupMenu[index].action?.call(context);
|
popupMenu[index].action?.call(context);
|
||||||
|
@ -36,7 +36,7 @@ class MainPageMaterial extends MainPageShared {
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
option.name,
|
option.name,
|
||||||
style: Theme.of(context).textTheme.headline4?.copyWith(
|
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||||
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
|
|
@ -6,7 +6,7 @@ class SelectStationPageStateCupertino extends SelectStationPageState {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
navigationBar: CupertinoNavigationBar(
|
navigationBar: const CupertinoNavigationBar(
|
||||||
middle: Text(SelectStationPageState.pageTitle),
|
middle: Text(SelectStationPageState.pageTitle),
|
||||||
),
|
),
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
|
@ -38,7 +38,7 @@ class SelectStationPageStateCupertino extends SelectStationPageState {
|
||||||
),
|
),
|
||||||
onTap: () => onSuggestionSelected(filteredStations[index]),
|
onTap: () => onSuggestionSelected(filteredStations[index]),
|
||||||
),
|
),
|
||||||
CupertinoDivider(),
|
const CupertinoDivider(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/src/widgets/framework.dart';
|
|
||||||
import 'package:info_tren/pages/station_arrdep_page/select_station/select_station.dart';
|
import 'package:info_tren/pages/station_arrdep_page/select_station/select_station.dart';
|
||||||
|
|
||||||
class SelectStationPageStateMaterial extends SelectStationPageState {
|
class SelectStationPageStateMaterial extends SelectStationPageState {
|
||||||
|
@ -7,7 +6,7 @@ class SelectStationPageStateMaterial extends SelectStationPageState {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(SelectStationPageState.pageTitle),
|
title: const Text(SelectStationPageState.pageTitle),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
|
@ -20,7 +19,7 @@ class SelectStationPageStateMaterial extends SelectStationPageState {
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: textEditingController,
|
controller: textEditingController,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
decoration: InputDecoration(
|
decoration: const InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: SelectStationPageState.textFieldLabel,
|
labelText: SelectStationPageState.textFieldLabel,
|
||||||
),
|
),
|
||||||
|
@ -39,7 +38,7 @@ class SelectStationPageStateMaterial extends SelectStationPageState {
|
||||||
title: Text(filteredStations[index]),
|
title: Text(filteredStations[index]),
|
||||||
onTap: () => onSuggestionSelected(filteredStations[index]),
|
onTap: () => onSuggestionSelected(filteredStations[index]),
|
||||||
),
|
),
|
||||||
Divider(
|
const Divider(
|
||||||
height: 1,
|
height: 1,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ViewStationPageStateCupertino extends ViewStationPageState {
|
||||||
),
|
),
|
||||||
child: snapshot.hasData ? CupertinoTabScaffold(
|
child: snapshot.hasData ? CupertinoTabScaffold(
|
||||||
tabBar: CupertinoTabBar(
|
tabBar: CupertinoTabBar(
|
||||||
items: [
|
items: const [
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(CupertinoIcons.arrow_down),
|
icon: Icon(CupertinoIcons.arrow_down),
|
||||||
label: ViewStationPageState.arrivals,
|
label: ViewStationPageState.arrivals,
|
||||||
|
@ -56,17 +56,16 @@ class ViewStationPageStateCupertino extends ViewStationPageState {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => onTrainTapped(item.train),
|
onTap: () => onTrainTapped(item.train),
|
||||||
child: CupertinoFormRow(
|
child: CupertinoFormRow(
|
||||||
child: Text('${item.time.toLocal().hour.toString().padLeft(2, '0')}:${item.time.toLocal().minute.toString().padLeft(2, '0')}'),
|
|
||||||
prefix: Text.rich(
|
prefix: Text.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: item.train.rank,
|
text: item.train.rank,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: item.train.rank.startsWith('IR') ? Color.fromARGB(255, 255, 0, 0) : null,
|
color: item.train.rank.startsWith('IR') ? const Color.fromARGB(255, 255, 0, 0) : null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(text: item.train.number,),
|
TextSpan(text: item.train.number,),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -74,12 +73,13 @@ class ViewStationPageStateCupertino extends ViewStationPageState {
|
||||||
helper: Text.rich(
|
helper: Text.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
TextSpan(text: ViewStationPageState.arrivesFrom),
|
const TextSpan(text: ViewStationPageState.arrivesFrom),
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(text: item.train.terminus),
|
TextSpan(text: item.train.terminus),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
child: Text('${item.time.toLocal().hour.toString().padLeft(2, '0')}:${item.time.toLocal().minute.toString().padLeft(2, '0')}'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -89,17 +89,16 @@ class ViewStationPageStateCupertino extends ViewStationPageState {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => onTrainTapped(item.train),
|
onTap: () => onTrainTapped(item.train),
|
||||||
child: CupertinoFormRow(
|
child: CupertinoFormRow(
|
||||||
child: Text('${item.time.toLocal().hour.toString().padLeft(2, '0')}:${item.time.toLocal().minute.toString().padLeft(2, '0')}'),
|
|
||||||
prefix: Text.rich(
|
prefix: Text.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: item.train.rank,
|
text: item.train.rank,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: item.train.rank.startsWith('IR') ? Color.fromARGB(255, 255, 0, 0) : null,
|
color: item.train.rank.startsWith('IR') ? const Color.fromARGB(255, 255, 0, 0) : null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(text: item.train.number,),
|
TextSpan(text: item.train.number,),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -107,12 +106,13 @@ class ViewStationPageStateCupertino extends ViewStationPageState {
|
||||||
helper: Text.rich(
|
helper: Text.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
TextSpan(text: ViewStationPageState.departsTo),
|
const TextSpan(text: ViewStationPageState.departsTo),
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(text: item.train.terminus),
|
TextSpan(text: item.train.terminus),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
child: Text('${item.time.toLocal().hour.toString().padLeft(2, '0')}:${item.time.toLocal().minute.toString().padLeft(2, '0')}'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class ViewStationPageStateMaterial extends ViewStationPageState {
|
||||||
? Container()
|
? Container()
|
||||||
: CustomScrollView(
|
: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverToBoxAdapter(child: SafeArea(child: Container(), left: false, bottom: false, right: false,),),
|
SliverToBoxAdapter(child: SafeArea(left: false, bottom: false, right: false,child: Container(),),),
|
||||||
SliverList(
|
SliverList(
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(context, index) {
|
(context, index) {
|
||||||
|
@ -33,7 +33,7 @@ class ViewStationPageStateMaterial extends ViewStationPageState {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
bottomNavigationBar: snapshot.hasData ? BottomNavigationBar(
|
bottomNavigationBar: snapshot.hasData ? BottomNavigationBar(
|
||||||
items: [
|
items: const [
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(Icons.arrow_downward),
|
icon: Icon(Icons.arrow_downward),
|
||||||
label: ViewStationPageState.arrivals,
|
label: ViewStationPageState.arrivals,
|
||||||
|
@ -67,7 +67,7 @@ class ViewStationPageStateMaterial extends ViewStationPageState {
|
||||||
'${item.time.toLocal().hour.toString().padLeft(2, '0')}:${item.time.toLocal().minute.toString().padLeft(2, '0')}',
|
'${item.time.toLocal().hour.toString().padLeft(2, '0')}:${item.time.toLocal().minute.toString().padLeft(2, '0')}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
inherit: true,
|
inherit: true,
|
||||||
fontFeatures: [
|
fontFeatures: const [
|
||||||
FontFeature.tabularFigures(),
|
FontFeature.tabularFigures(),
|
||||||
],
|
],
|
||||||
decoration: item.status.cancelled || item.status.delay != 0 ? TextDecoration.lineThrough : null,
|
decoration: item.status.cancelled || item.status.delay != 0 ? TextDecoration.lineThrough : null,
|
||||||
|
@ -83,7 +83,7 @@ class ViewStationPageStateMaterial extends ViewStationPageState {
|
||||||
'${newTime.toLocal().hour.toString().padLeft(2, '0')}:${newTime.toLocal().minute.toString().padLeft(2, '0')}',
|
'${newTime.toLocal().hour.toString().padLeft(2, '0')}:${newTime.toLocal().minute.toString().padLeft(2, '0')}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
inherit: true,
|
inherit: true,
|
||||||
fontFeatures: [
|
fontFeatures: const [
|
||||||
FontFeature.tabularFigures(),
|
FontFeature.tabularFigures(),
|
||||||
],
|
],
|
||||||
color: delay ? Colors.red : Colors.green,
|
color: delay ? Colors.red : Colors.green,
|
||||||
|
@ -104,10 +104,10 @@ class ViewStationPageStateMaterial extends ViewStationPageState {
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: item.train.rank,
|
text: item.train.rank,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: item.train.rank.startsWith('IR') ? Color.fromARGB(255, 255, 0, 0) : null,
|
color: item.train.rank.startsWith('IR') ? const Color.fromARGB(255, 255, 0, 0) : null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(text: item.train.number,),
|
TextSpan(text: item.train.number,),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -122,21 +122,21 @@ class ViewStationPageStateMaterial extends ViewStationPageState {
|
||||||
? (arrival ? ViewStationPageState.arrivedFrom : ViewStationPageState.departedTo)
|
? (arrival ? ViewStationPageState.arrivedFrom : ViewStationPageState.departedTo)
|
||||||
: (arrival ? ViewStationPageState.arrivesFrom : ViewStationPageState.departsTo)
|
: (arrival ? ViewStationPageState.arrivesFrom : ViewStationPageState.departsTo)
|
||||||
),
|
),
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(text: item.train.terminus),
|
TextSpan(text: item.train.terminus),
|
||||||
if (item.status.delay != 0) ...[
|
if (item.status.delay != 0) ...[
|
||||||
TextSpan(text: '\n'),
|
const TextSpan(text: '\n'),
|
||||||
if (item.status.delay.abs() >= 60) ...[
|
if (item.status.delay.abs() >= 60) ...[
|
||||||
TextSpan(text: (item.status.delay.abs() ~/ 60).toString()),
|
TextSpan(text: (item.status.delay.abs() ~/ 60).toString()),
|
||||||
TextSpan(text: item.status.delay.abs() >= 120 ? ' ore' : ' oră'),
|
TextSpan(text: item.status.delay.abs() >= 120 ? ' ore' : ' oră'),
|
||||||
if (item.status.delay.abs() % 60 != 0)
|
if (item.status.delay.abs() % 60 != 0)
|
||||||
TextSpan(text: ' și '),
|
const TextSpan(text: ' și '),
|
||||||
],
|
],
|
||||||
TextSpan(text: (item.status.delay.abs() % 60).toString()),
|
TextSpan(text: (item.status.delay.abs() % 60).toString()),
|
||||||
TextSpan(text: item.status.delay.abs() > 1 ? ' minute' : ' minut'),
|
TextSpan(text: item.status.delay.abs() > 1 ? ' minute' : ' minut'),
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
if (item.status.delay > 0)
|
if (item.status.delay > 0)
|
||||||
TextSpan(
|
const TextSpan(
|
||||||
text: 'întârziere',
|
text: 'întârziere',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
inherit: true,
|
inherit: true,
|
||||||
|
@ -144,7 +144,7 @@ class ViewStationPageStateMaterial extends ViewStationPageState {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
TextSpan(
|
const TextSpan(
|
||||||
text: 'mai devreme',
|
text: 'mai devreme',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
inherit: true,
|
inherit: true,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'dart:io' show Platform;
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
@ -9,14 +8,13 @@ import 'package:info_tren/pages/train_info_page/select_train/select_train_materi
|
||||||
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/utils/default_ui_design.dart';
|
import 'package:info_tren/utils/default_ui_design.dart';
|
||||||
import 'package:info_tren/api/trains.dart' as apiTrains;
|
import 'package:info_tren/api/trains.dart' as apiTrains;
|
||||||
import 'package:tuple/tuple.dart';
|
|
||||||
|
|
||||||
typedef TrainSelectedCallback(int trainNumber);
|
typedef TrainSelectedCallback = Function(int trainNumber);
|
||||||
|
|
||||||
class SelectTrainPage extends StatefulWidget {
|
class SelectTrainPage extends StatefulWidget {
|
||||||
final UiDesign? uiDesign;
|
final UiDesign? uiDesign;
|
||||||
|
|
||||||
SelectTrainPage({Key? key, this.uiDesign}) : super(key: key);
|
const SelectTrainPage({Key? key, this.uiDesign}) : super(key: key);
|
||||||
|
|
||||||
static String routeName = "/trainInfo/selectTrain";
|
static String routeName = "/trainInfo/selectTrain";
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class SelectTrainPageStateMaterial extends SelectTrainPageState {
|
||||||
controller: trainNoController,
|
controller: trainNoController,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
labelText: textFieldLabel,
|
labelText: textFieldLabel,
|
||||||
),
|
),
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
|
|
|
@ -17,7 +17,7 @@ class TrainInfo extends StatelessWidget {
|
||||||
final String trainNumber;
|
final String trainNumber;
|
||||||
final DateTime? date;
|
final DateTime? date;
|
||||||
|
|
||||||
TrainInfo({Key? key, required this.trainNumber, this.date, this.uiDesign}): super(key: key);
|
const TrainInfo({Key? key, required this.trainNumber, this.date, this.uiDesign}): super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -85,7 +85,7 @@ abstract class TrainInfoError extends StatelessWidget {
|
||||||
final Object error;
|
final Object error;
|
||||||
final Future Function()? refresh;
|
final Future Function()? refresh;
|
||||||
|
|
||||||
TrainInfoError({required this.title, required this.error, this.refresh});
|
const TrainInfoError({required this.title, required this.error, this.refresh});
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class DisplayTrainYesterdayWarningCommon extends StatelessWidget {
|
abstract class DisplayTrainYesterdayWarningCommon extends StatelessWidget {
|
||||||
|
@ -94,5 +94,5 @@ abstract class DisplayTrainYesterdayWarningCommon extends StatelessWidget {
|
||||||
|
|
||||||
final void Function() onViewYesterdayTrain;
|
final void Function() onViewYesterdayTrain;
|
||||||
|
|
||||||
DisplayTrainYesterdayWarningCommon(this.onViewYesterdayTrain);
|
const DisplayTrainYesterdayWarningCommon(this.onViewYesterdayTrain);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class TrainInfoLoadingCupertino extends TrainInfoLoading {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TrainInfoErrorCupertino extends TrainInfoError {
|
class TrainInfoErrorCupertino extends TrainInfoError {
|
||||||
TrainInfoErrorCupertino({
|
const TrainInfoErrorCupertino({
|
||||||
required Object error,
|
required Object error,
|
||||||
required String title,
|
required String title,
|
||||||
Future Function()? refresh,
|
Future Function()? refresh,
|
||||||
|
@ -56,7 +56,7 @@ class TrainInfoErrorCupertino extends TrainInfoError {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: CupertinoButton(
|
child: CupertinoButton(
|
||||||
child: Text('Retry'),
|
child: const Text('Retry'),
|
||||||
onPressed: () => refresh!(),
|
onPressed: () => refresh!(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -73,7 +73,7 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
final bool? isRefreshing;
|
final bool? isRefreshing;
|
||||||
final void Function()? onViewYesterdayTrain;
|
final void Function()? onViewYesterdayTrain;
|
||||||
|
|
||||||
TrainInfoCupertino({
|
const TrainInfoCupertino({
|
||||||
required this.trainData,
|
required this.trainData,
|
||||||
this.refresh,
|
this.refresh,
|
||||||
this.isRefreshing,
|
this.isRefreshing,
|
||||||
|
@ -85,10 +85,10 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
navigationBar: CupertinoNavigationBar(
|
navigationBar: CupertinoNavigationBar(
|
||||||
middle: Text("Informații despre ${trainData.rank} ${trainData.number}"),
|
middle: Text("Informații despre ${trainData.rank} ${trainData.number}"),
|
||||||
trailing: refresh == null ? null : isRefreshing == true ? CupertinoActivityIndicator() : CupertinoButton(
|
trailing: refresh == null ? null : isRefreshing == true ? const CupertinoActivityIndicator() : CupertinoButton(
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Icon(CupertinoIcons.refresh),
|
child: const Icon(CupertinoIcons.refresh),
|
||||||
onPressed: () => refresh!(),
|
onPressed: () => refresh!(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -121,11 +121,11 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
SizedBox(
|
||||||
height: pulledExtent,
|
height: pulledExtent,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
SizedBox(
|
||||||
height: min(
|
height: min(
|
||||||
refreshIndicatorExtent, pulledExtent),
|
refreshIndicatorExtent, pulledExtent),
|
||||||
child: Center(
|
child: Center(
|
||||||
|
@ -136,12 +136,12 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
return Container();
|
return Container();
|
||||||
} else if (mode ==
|
} else if (mode ==
|
||||||
RefreshIndicatorMode.done) {
|
RefreshIndicatorMode.done) {
|
||||||
return Text('Refreshed!');
|
return const Text('Refreshed!');
|
||||||
} else if (mode ==
|
} else if (mode ==
|
||||||
RefreshIndicatorMode.drag) {
|
RefreshIndicatorMode.drag) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: const [
|
||||||
CupertinoActivityIndicator(
|
CupertinoActivityIndicator(
|
||||||
animating: false,
|
animating: false,
|
||||||
),
|
),
|
||||||
|
@ -152,7 +152,7 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
RefreshIndicatorMode.armed) {
|
RefreshIndicatorMode.armed) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: const [
|
||||||
CupertinoActivityIndicator(
|
CupertinoActivityIndicator(
|
||||||
animating: false,
|
animating: false,
|
||||||
),
|
),
|
||||||
|
@ -162,7 +162,7 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
} else {
|
} else {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: const [
|
||||||
CupertinoActivityIndicator(),
|
CupertinoActivityIndicator(),
|
||||||
Text('Refreshing'),
|
Text('Refreshing'),
|
||||||
],
|
],
|
||||||
|
@ -195,7 +195,7 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
DisplayTrainDeparture(
|
DisplayTrainDeparture(
|
||||||
trainData: trainData,
|
trainData: trainData,
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
const SliverToBoxAdapter(
|
||||||
child: CupertinoDivider(
|
child: CupertinoDivider(
|
||||||
color: FOREGROUND_WHITE,
|
color: FOREGROUND_WHITE,
|
||||||
),
|
),
|
||||||
|
@ -203,7 +203,7 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
DisplayTrainLastInfo(
|
DisplayTrainLastInfo(
|
||||||
trainData: trainData,
|
trainData: trainData,
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
const SliverToBoxAdapter(
|
||||||
child: CupertinoDivider(),
|
child: CupertinoDivider(),
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
|
@ -221,7 +221,7 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
// Expanded(
|
// Expanded(
|
||||||
// child: DisplayTrainDestination(trainData: trainData,),
|
// child: DisplayTrainDestination(trainData: trainData,),
|
||||||
// ),
|
// ),
|
||||||
SizedBox(
|
const SizedBox(
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
child: CupertinoVerticalDivider(),
|
child: CupertinoVerticalDivider(),
|
||||||
),
|
),
|
||||||
|
@ -256,7 +256,7 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
SliverToBoxAdapter(
|
const SliverToBoxAdapter(
|
||||||
child: CupertinoDivider(
|
child: CupertinoDivider(
|
||||||
color: FOREGROUND_WHITE,
|
color: FOREGROUND_WHITE,
|
||||||
),
|
),
|
||||||
|
@ -265,7 +265,7 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: DisplayTrainYesterdayWarningCupertino(onViewYesterdayTrain!),
|
child: DisplayTrainYesterdayWarningCupertino(onViewYesterdayTrain!),
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
const SliverToBoxAdapter(
|
||||||
child: CupertinoDivider(
|
child: CupertinoDivider(
|
||||||
color: FOREGROUND_WHITE,
|
color: FOREGROUND_WHITE,
|
||||||
),
|
),
|
||||||
|
@ -394,7 +394,7 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
|
|
||||||
class DisplayTrainID extends StatelessWidget {
|
class DisplayTrainID extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
DisplayTrainID({required this.trainData});
|
const DisplayTrainID({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -408,10 +408,10 @@ 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') ? const Color.fromARGB(255, 255, 0, 0) : null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(text: trainData.number,),
|
TextSpan(text: trainData.number,),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -426,7 +426,7 @@ class DisplayTrainID extends StatelessWidget {
|
||||||
class DisplayTrainRoute extends StatelessWidget {
|
class DisplayTrainRoute extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainRoute({required this.trainData});
|
const DisplayTrainRoute({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -447,7 +447,7 @@ class DisplayTrainRoute extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Center(child: Text("-")),
|
const Center(child: Text("-")),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
@ -472,7 +472,7 @@ class DisplayTrainRoute extends StatelessWidget {
|
||||||
class DisplayTrainOperator extends StatelessWidget {
|
class DisplayTrainOperator extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainOperator({required this.trainData});
|
const DisplayTrainOperator({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -493,7 +493,7 @@ class DisplayTrainOperator extends StatelessWidget {
|
||||||
class DisplayTrainDeparture extends StatelessWidget {
|
class DisplayTrainDeparture extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainDeparture({required this.trainData});
|
const DisplayTrainDeparture({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -517,7 +517,7 @@ class DisplayTrainDeparture extends StatelessWidget {
|
||||||
class DisplayTrainLastInfo extends StatelessWidget {
|
class DisplayTrainLastInfo extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainLastInfo({required this.trainData});
|
const DisplayTrainLastInfo({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -691,7 +691,7 @@ class DisplayTrainLastInfo extends StatelessWidget {
|
||||||
class DisplayTrainDestination extends StatelessWidget {
|
class DisplayTrainDestination extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainDestination({required this.trainData});
|
const DisplayTrainDestination({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -709,7 +709,7 @@ class DisplayTrainDestination extends StatelessWidget {
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
CupertinoDivider(
|
const CupertinoDivider(
|
||||||
color: Color.fromRGBO(15, 15, 15, 1),
|
color: Color.fromRGBO(15, 15, 15, 1),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -749,20 +749,20 @@ class DisplayTrainDestination extends StatelessWidget {
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: 'la',
|
text: 'la',
|
||||||
children: [
|
children: [
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text:
|
text:
|
||||||
'${arrival.hour.toString().padLeft(2, "0")}:${arrival.minute.toString().padLeft(2, "0")}',
|
'${arrival.hour.toString().padLeft(2, "0")}:${arrival.minute.toString().padLeft(2, "0")}',
|
||||||
style: delay == 0
|
style: delay == 0
|
||||||
? null
|
? null
|
||||||
: TextStyle(
|
: const TextStyle(
|
||||||
decoration: TextDecoration.lineThrough,
|
decoration: TextDecoration.lineThrough,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (delay != 0) ...[
|
if (delay != 0) ...[
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: '$arrivalWithDelayString',
|
text: arrivalWithDelayString,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: delay > 0
|
color: delay > 0
|
||||||
? CupertinoColors.systemRed
|
? CupertinoColors.systemRed
|
||||||
|
@ -791,7 +791,7 @@ class DisplayTrainDestination extends StatelessWidget {
|
||||||
class DisplayTrainRouteDistance extends StatelessWidget {
|
class DisplayTrainRouteDistance extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainRouteDistance({required this.trainData});
|
const DisplayTrainRouteDistance({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -821,7 +821,7 @@ class DisplayTrainRouteDistance extends StatelessWidget {
|
||||||
class DisplayTrainRouteDuration extends StatelessWidget {
|
class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainRouteDuration({required this.trainData});
|
const DisplayTrainRouteDuration({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -848,10 +848,11 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
|
|
||||||
if (duration.inDays > 0) {
|
if (duration.inDays > 0) {
|
||||||
firstWritten = true;
|
firstWritten = true;
|
||||||
if (duration.inDays == 1)
|
if (duration.inDays == 1) {
|
||||||
durationString.write("1 zi");
|
durationString.write("1 zi");
|
||||||
else
|
} else {
|
||||||
durationString.write("${duration.inDays} zile");
|
durationString.write("${duration.inDays} zile");
|
||||||
|
}
|
||||||
duration -= Duration(days: duration.inDays);
|
duration -= Duration(days: duration.inDays);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,10 +861,11 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
durationString.write(", ");
|
durationString.write(", ");
|
||||||
}
|
}
|
||||||
firstWritten = true;
|
firstWritten = true;
|
||||||
if (duration.inHours == 1)
|
if (duration.inHours == 1) {
|
||||||
durationString.write("1 oră");
|
durationString.write("1 oră");
|
||||||
else
|
} else {
|
||||||
durationString.write("${duration.inHours} ore");
|
durationString.write("${duration.inHours} ore");
|
||||||
|
}
|
||||||
duration -= Duration(hours: duration.inHours);
|
duration -= Duration(hours: duration.inHours);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -872,10 +874,11 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
durationString.write(", ");
|
durationString.write(", ");
|
||||||
}
|
}
|
||||||
firstWritten = true;
|
firstWritten = true;
|
||||||
if (duration.inMinutes == 1)
|
if (duration.inMinutes == 1) {
|
||||||
durationString.write("1 minut");
|
durationString.write("1 minut");
|
||||||
else
|
} else {
|
||||||
durationString.write("${duration.inMinutes} minute");
|
durationString.write("${duration.inMinutes} minute");
|
||||||
|
}
|
||||||
duration -= Duration(minutes: duration.inMinutes);
|
duration -= Duration(minutes: duration.inMinutes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -894,7 +897,7 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DisplayTrainYesterdayWarningCupertino extends DisplayTrainYesterdayWarningCommon {
|
class DisplayTrainYesterdayWarningCupertino extends DisplayTrainYesterdayWarningCommon {
|
||||||
DisplayTrainYesterdayWarningCupertino(void Function() onViewYesterdayTrain) : super(onViewYesterdayTrain);
|
const DisplayTrainYesterdayWarningCupertino(void Function() onViewYesterdayTrain) : super(onViewYesterdayTrain);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -906,11 +909,11 @@ class DisplayTrainYesterdayWarningCupertino extends DisplayTrainYesterdayWarning
|
||||||
child: Text.rich(
|
child: Text.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
TextSpan(text: DisplayTrainYesterdayWarningCommon.trainDidNotDepart,),
|
const TextSpan(text: DisplayTrainYesterdayWarningCommon.trainDidNotDepart,),
|
||||||
TextSpan(text: '\n'),
|
const TextSpan(text: '\n'),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: DisplayTrainYesterdayWarningCommon.seeYesterdayTrain,
|
text: DisplayTrainYesterdayWarningCommon.seeYesterdayTrain,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
color: CupertinoColors.link,
|
color: CupertinoColors.link,
|
||||||
),
|
),
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
|
@ -929,7 +932,7 @@ class DisplayTrainYesterdayWarningCupertino extends DisplayTrainYesterdayWarning
|
||||||
class DisplayTrainStations extends StatelessWidget {
|
class DisplayTrainStations extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainStations({
|
const DisplayTrainStations({
|
||||||
required this.trainData,
|
required this.trainData,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -939,14 +942,14 @@ class DisplayTrainStations extends StatelessWidget {
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(context, index) {
|
(context, index) {
|
||||||
if (index.isOdd) {
|
if (index.isOdd) {
|
||||||
return CupertinoDivider();
|
return const CupertinoDivider();
|
||||||
} else {
|
} else {
|
||||||
final itemIndex = index ~/ 2;
|
final itemIndex = index ~/ 2;
|
||||||
return IndexedSemantics(
|
return IndexedSemantics(
|
||||||
|
index: itemIndex,
|
||||||
child: DisplayTrainStation(
|
child: DisplayTrainStation(
|
||||||
station: trainData.stations[itemIndex],
|
station: trainData.stations[itemIndex],
|
||||||
),
|
),
|
||||||
index: itemIndex,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,7 +5,7 @@ import 'package:info_tren/models.dart';
|
||||||
class DisplayTrainStation extends StatelessWidget {
|
class DisplayTrainStation extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
|
|
||||||
DisplayTrainStation({required this.station});
|
const DisplayTrainStation({required this.station});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -45,7 +45,7 @@ class DisplayTrainStation extends StatelessWidget {
|
||||||
|
|
||||||
final isDelayed = delay > 0 && real == true;
|
final isDelayed = delay > 0 && real == true;
|
||||||
final isOnTime = delay <= 0 && real == true;
|
final isOnTime = delay <= 0 && real == true;
|
||||||
final isNotScheduled = false;
|
const isNotScheduled = false;
|
||||||
|
|
||||||
return CupertinoBadge(
|
return CupertinoBadge(
|
||||||
text: station.km.toString(),
|
text: station.km.toString(),
|
||||||
|
@ -84,7 +84,7 @@ class DisplayTrainStation extends StatelessWidget {
|
||||||
class Title extends StatelessWidget {
|
class Title extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
|
|
||||||
Title({
|
const Title({
|
||||||
required this.station
|
required this.station
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ class Title extends StatelessWidget {
|
||||||
class Time extends StatelessWidget {
|
class Time extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
|
|
||||||
Time({
|
const Time({
|
||||||
required this.station,
|
required this.station,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ class ArrivalTime extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
final bool finalStation;
|
final bool finalStation;
|
||||||
|
|
||||||
ArrivalTime({
|
const ArrivalTime({
|
||||||
required this.station,
|
required this.station,
|
||||||
this.finalStation = false,
|
this.finalStation = false,
|
||||||
});
|
});
|
||||||
|
@ -176,7 +176,7 @@ class ArrivalTime extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(width: 2,),
|
Container(width: 2,),
|
||||||
Text("sosire la "),
|
const Text("sosire la "),
|
||||||
ArrivalTime(station: station,),
|
ArrivalTime(station: station,),
|
||||||
Expanded(child: Container(),),
|
Expanded(child: Container(),),
|
||||||
],
|
],
|
||||||
|
@ -240,7 +240,7 @@ class ArrivalTime extends StatelessWidget {
|
||||||
class StopTime extends StatelessWidget {
|
class StopTime extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
|
|
||||||
StopTime({
|
const StopTime({
|
||||||
required this.station,
|
required this.station,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ class StopTime extends StatelessWidget {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
const Text(
|
||||||
"staționează pentru",
|
"staționează pentru",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
@ -270,13 +270,13 @@ class StopTime extends StatelessWidget {
|
||||||
}
|
}
|
||||||
else if (stopsForInt < 20) {
|
else if (stopsForInt < 20) {
|
||||||
return Text(
|
return Text(
|
||||||
'$stopsForInt ' + (minutes ? 'minute' : 'seconde'),
|
'$stopsForInt ${minutes ? 'minute' : 'seconde'}',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Text(
|
return Text(
|
||||||
'$stopsForInt de ' + (minutes ? 'minute' : 'secunde'),
|
'$stopsForInt de ${minutes ? 'minute' : 'secunde'}',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ class DepartureTime extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
final bool firstStation;
|
final bool firstStation;
|
||||||
|
|
||||||
DepartureTime({
|
const DepartureTime({
|
||||||
required this.station,
|
required this.station,
|
||||||
this.firstStation = false,
|
this.firstStation = false,
|
||||||
});
|
});
|
||||||
|
@ -303,7 +303,7 @@ class DepartureTime extends StatelessWidget {
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(child: Container(),),
|
Expanded(child: Container(),),
|
||||||
Text("plecare la "),
|
const Text("plecare la "),
|
||||||
DepartureTime(station: station,),
|
DepartureTime(station: station,),
|
||||||
Container(width: 2,),
|
Container(width: 2,),
|
||||||
Text(
|
Text(
|
||||||
|
@ -373,7 +373,7 @@ class DepartureTime extends StatelessWidget {
|
||||||
class Delay extends StatelessWidget {
|
class Delay extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
|
|
||||||
Delay({
|
const Delay({
|
||||||
required this.station,
|
required this.station,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -387,8 +387,9 @@ class Delay extends StatelessWidget {
|
||||||
delay = station.departure?.status?.delay;
|
delay = station.departure?.status?.delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delay == 0 || delay == null) return Container();
|
if (delay == 0 || delay == null) {
|
||||||
else if (delay > 0) {
|
return Container();
|
||||||
|
} else if (delay > 0) {
|
||||||
return Text(
|
return Text(
|
||||||
"$delay ${delay == 1 ? 'minut' : 'minute'} întârziere",
|
"$delay ${delay == 1 ? 'minut' : 'minute'} întârziere",
|
||||||
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
||||||
|
|
|
@ -29,7 +29,7 @@ class TrainInfoLoadingMaterial extends TrainInfoLoading {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TrainInfoErrorMaterial extends TrainInfoError {
|
class TrainInfoErrorMaterial extends TrainInfoError {
|
||||||
TrainInfoErrorMaterial({
|
const TrainInfoErrorMaterial({
|
||||||
required Object error,
|
required Object error,
|
||||||
required String title,
|
required String title,
|
||||||
Future Function()? refresh,
|
Future Function()? refresh,
|
||||||
|
@ -54,7 +54,7 @@ class TrainInfoErrorMaterial extends TrainInfoError {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
child: Text('Retry'),
|
child: const Text('Retry'),
|
||||||
onPressed: () => refresh!(),
|
onPressed: () => refresh!(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -73,7 +73,7 @@ class TrainInfoMaterial extends StatelessWidget {
|
||||||
final Future Function()? refresh;
|
final Future Function()? refresh;
|
||||||
final void Function()? onViewYesterdayTrain;
|
final void Function()? onViewYesterdayTrain;
|
||||||
|
|
||||||
TrainInfoMaterial({
|
const TrainInfoMaterial({
|
||||||
required this.trainData,
|
required this.trainData,
|
||||||
this.refresh,
|
this.refresh,
|
||||||
this.onViewYesterdayTrain,
|
this.onViewYesterdayTrain,
|
||||||
|
@ -219,7 +219,7 @@ class TrainInfoMaterial extends StatelessWidget {
|
||||||
class DisplayTrainID extends StatelessWidget {
|
class DisplayTrainID extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainID({required this.trainData});
|
const DisplayTrainID({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -230,21 +230,21 @@ class DisplayTrainID extends StatelessWidget {
|
||||||
text: trainData.rank,
|
text: trainData.rank,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: trainData.rank.startsWith('IR')
|
color: trainData.rank.startsWith('IR')
|
||||||
? Color.fromARGB(255, 255, 0, 0)
|
? const Color.fromARGB(255, 255, 0, 0)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: trainData.number,
|
text: trainData.number,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
style: (isSmallScreen(context)
|
style: (isSmallScreen(context)
|
||||||
? Theme.of(context).textTheme.headline4
|
? Theme.of(context).textTheme.headlineMedium
|
||||||
: Theme.of(context).textTheme.headline3)
|
: Theme.of(context).textTheme.displaySmall)
|
||||||
?.copyWith(
|
?.copyWith(
|
||||||
color: Theme.of(context).textTheme.bodyText2?.color,
|
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
@ -255,13 +255,13 @@ class DisplayTrainID extends StatelessWidget {
|
||||||
class DisplayTrainOperator extends StatelessWidget {
|
class DisplayTrainOperator extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainOperator({required this.trainData});
|
const DisplayTrainOperator({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Text(
|
return Text(
|
||||||
trainData.operator,
|
trainData.operator,
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
fontSize: isSmallScreen(context) ? 12 : 14,
|
fontSize: isSmallScreen(context) ? 12 : 14,
|
||||||
),
|
),
|
||||||
|
@ -273,7 +273,7 @@ class DisplayTrainOperator extends StatelessWidget {
|
||||||
class DisplayTrainRoute extends StatelessWidget {
|
class DisplayTrainRoute extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainRoute({required this.trainData});
|
const DisplayTrainRoute({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -285,21 +285,21 @@ class DisplayTrainRoute extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Text(
|
child: Text(
|
||||||
trainData.route.from,
|
trainData.route.from,
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Center(child: Text("-")),
|
const Center(child: Text("-")),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Text(
|
child: Text(
|
||||||
trainData.route.to,
|
trainData.route.to,
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
|
@ -315,7 +315,7 @@ class DisplayTrainRoute extends StatelessWidget {
|
||||||
class DisplayTrainDeparture extends StatelessWidget {
|
class DisplayTrainDeparture extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainDeparture({required this.trainData});
|
const DisplayTrainDeparture({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -324,7 +324,7 @@ class DisplayTrainDeparture extends StatelessWidget {
|
||||||
child: Text(
|
child: Text(
|
||||||
// "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.bodyMedium?.copyWith(
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
fontWeight: FontWeight.w200,
|
fontWeight: FontWeight.w200,
|
||||||
fontSize: isSmallScreen(context) ? 14 : 16,
|
fontSize: isSmallScreen(context) ? 14 : 16,
|
||||||
|
@ -338,7 +338,7 @@ class DisplayTrainDeparture extends StatelessWidget {
|
||||||
class DisplayTrainLastInfo extends StatelessWidget {
|
class DisplayTrainLastInfo extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainLastInfo({required this.trainData});
|
const DisplayTrainLastInfo({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -357,7 +357,7 @@ class DisplayTrainLastInfo extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(2),
|
padding: const EdgeInsets.all(2),
|
||||||
child: Text(
|
child: Text(
|
||||||
"Ultima informație",
|
"Ultima informație",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 20 : 22,
|
fontSize: isSmallScreen(context) ? 20 : 22,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
|
@ -370,7 +370,7 @@ class DisplayTrainLastInfo extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Text(
|
child: Text(
|
||||||
trainData.status!.station,
|
trainData.status!.station,
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 16 : 18,
|
fontSize: isSmallScreen(context) ? 16 : 18,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
|
@ -418,7 +418,7 @@ class DisplayTrainLastInfo extends StatelessWidget {
|
||||||
return Text(
|
return Text(
|
||||||
"$data ${data == 1 ? 'minut' : 'minute'} întârziere",
|
"$data ${data == 1 ? 'minut' : 'minute'} întârziere",
|
||||||
style:
|
style:
|
||||||
Theme.of(context).textTheme.bodyText2?.copyWith(
|
Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 14 : 16,
|
fontSize: isSmallScreen(context) ? 14 : 16,
|
||||||
color: Colors.red.shade300,
|
color: Colors.red.shade300,
|
||||||
),
|
),
|
||||||
|
@ -427,7 +427,7 @@ class DisplayTrainLastInfo extends StatelessWidget {
|
||||||
return Text(
|
return Text(
|
||||||
"${-data} ${data == -1 ? 'minut' : 'minute'} mai devreme",
|
"${-data} ${data == -1 ? 'minut' : 'minute'} mai devreme",
|
||||||
style:
|
style:
|
||||||
Theme.of(context).textTheme.bodyText2?.copyWith(
|
Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 14 : 16,
|
fontSize: isSmallScreen(context) ? 14 : 16,
|
||||||
color: Colors.green.shade300,
|
color: Colors.green.shade300,
|
||||||
),
|
),
|
||||||
|
@ -530,7 +530,7 @@ class DisplayTrainLastInfo extends StatelessWidget {
|
||||||
class DisplayTrainDestination extends StatelessWidget {
|
class DisplayTrainDestination extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainDestination({required this.trainData});
|
const DisplayTrainDestination({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -547,7 +547,7 @@ class DisplayTrainDestination extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Text(
|
child: Text(
|
||||||
"Destinația",
|
"Destinația",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 20 : 22,
|
fontSize: isSmallScreen(context) ? 20 : 22,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
|
@ -558,7 +558,7 @@ class DisplayTrainDestination extends StatelessWidget {
|
||||||
padding: const EdgeInsets.fromLTRB(4, 0, 4, 0),
|
padding: const EdgeInsets.fromLTRB(4, 0, 4, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
destination.name,
|
destination.name,
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 18 : 20,
|
fontSize: isSmallScreen(context) ? 18 : 20,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
|
@ -591,20 +591,20 @@ class DisplayTrainDestination extends StatelessWidget {
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: 'la',
|
text: 'la',
|
||||||
children: [
|
children: [
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text:
|
text:
|
||||||
'${arrival.hour.toString().padLeft(2, '0')}:${arrival.minute.toString().padLeft(2, '0')}',
|
'${arrival.hour.toString().padLeft(2, '0')}:${arrival.minute.toString().padLeft(2, '0')}',
|
||||||
style: delay == 0
|
style: delay == 0
|
||||||
? null
|
? null
|
||||||
: TextStyle(
|
: const TextStyle(
|
||||||
decoration: TextDecoration.lineThrough,
|
decoration: TextDecoration.lineThrough,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (delay != 0) ...[
|
if (delay != 0) ...[
|
||||||
TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: '$arrivalWithDelayString',
|
text: arrivalWithDelayString,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: delay > 0
|
color: delay > 0
|
||||||
? Colors.red.shade300
|
? Colors.red.shade300
|
||||||
|
@ -614,7 +614,7 @@ class DisplayTrainDestination extends StatelessWidget {
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 14 : 16,
|
fontSize: isSmallScreen(context) ? 14 : 16,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
@ -634,7 +634,7 @@ class DisplayTrainDestination extends StatelessWidget {
|
||||||
class DisplayTrainRouteDistance extends StatelessWidget {
|
class DisplayTrainRouteDistance extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainRouteDistance({required this.trainData});
|
const DisplayTrainRouteDistance({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -647,7 +647,7 @@ class DisplayTrainRouteDistance extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"Distanța rutei",
|
"Distanța rutei",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 20 : 22,
|
fontSize: isSmallScreen(context) ? 20 : 22,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
|
@ -655,7 +655,7 @@ class DisplayTrainRouteDistance extends StatelessWidget {
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"${trainData.stations.last.km} km",
|
"${trainData.stations.last.km} km",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 18 : 20,
|
fontSize: isSmallScreen(context) ? 18 : 20,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
@ -671,7 +671,7 @@ class DisplayTrainRouteDistance extends StatelessWidget {
|
||||||
class DisplayTrainRouteDuration extends StatelessWidget {
|
class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
DisplayTrainRouteDuration({required this.trainData});
|
const DisplayTrainRouteDuration({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -684,7 +684,7 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"Durata rutei",
|
"Durata rutei",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 20 : 22,
|
fontSize: isSmallScreen(context) ? 20 : 22,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
|
@ -701,10 +701,11 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
|
|
||||||
if (duration.inDays > 0) {
|
if (duration.inDays > 0) {
|
||||||
firstWritten = true;
|
firstWritten = true;
|
||||||
if (duration.inDays == 1)
|
if (duration.inDays == 1) {
|
||||||
durationString.write("1 zi");
|
durationString.write("1 zi");
|
||||||
else
|
} else {
|
||||||
durationString.write("${duration.inDays} zile");
|
durationString.write("${duration.inDays} zile");
|
||||||
|
}
|
||||||
duration -= Duration(days: duration.inDays);
|
duration -= Duration(days: duration.inDays);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,10 +714,11 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
durationString.write(", ");
|
durationString.write(", ");
|
||||||
}
|
}
|
||||||
firstWritten = true;
|
firstWritten = true;
|
||||||
if (duration.inHours == 1)
|
if (duration.inHours == 1) {
|
||||||
durationString.write("1 oră");
|
durationString.write("1 oră");
|
||||||
else
|
} else {
|
||||||
durationString.write("${duration.inHours} ore");
|
durationString.write("${duration.inHours} ore");
|
||||||
|
}
|
||||||
duration -= Duration(hours: duration.inHours);
|
duration -= Duration(hours: duration.inHours);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -725,16 +727,17 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
durationString.write(", ");
|
durationString.write(", ");
|
||||||
}
|
}
|
||||||
firstWritten = true;
|
firstWritten = true;
|
||||||
if (duration.inMinutes == 1)
|
if (duration.inMinutes == 1) {
|
||||||
durationString.write("1 minut");
|
durationString.write("1 minut");
|
||||||
else
|
} else {
|
||||||
durationString.write("${duration.inMinutes} minute");
|
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.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 18 : 20,
|
fontSize: isSmallScreen(context) ? 18 : 20,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
@ -751,7 +754,7 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
|
|
||||||
class DisplayTrainYesterdayWarningMaterial
|
class DisplayTrainYesterdayWarningMaterial
|
||||||
extends DisplayTrainYesterdayWarningCommon {
|
extends DisplayTrainYesterdayWarningCommon {
|
||||||
DisplayTrainYesterdayWarningMaterial(void Function() onViewYesterdayTrain)
|
const DisplayTrainYesterdayWarningMaterial(void Function() onViewYesterdayTrain)
|
||||||
: super(onViewYesterdayTrain);
|
: super(onViewYesterdayTrain);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -764,13 +767,13 @@ class DisplayTrainYesterdayWarningMaterial
|
||||||
child: Text.rich(
|
child: Text.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
const TextSpan(
|
||||||
text: DisplayTrainYesterdayWarningCommon.trainDidNotDepart,
|
text: DisplayTrainYesterdayWarningCommon.trainDidNotDepart,
|
||||||
),
|
),
|
||||||
TextSpan(text: '\n'),
|
const TextSpan(text: '\n'),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: DisplayTrainYesterdayWarningCommon.seeYesterdayTrain,
|
text: DisplayTrainYesterdayWarningCommon.seeYesterdayTrain,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
|
@ -788,7 +791,7 @@ class DisplayTrainYesterdayWarningMaterial
|
||||||
|
|
||||||
class DisplayTrainStations extends StatelessWidget {
|
class DisplayTrainStations extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
DisplayTrainStations({required this.trainData});
|
const DisplayTrainStations({required this.trainData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -796,6 +799,7 @@ class DisplayTrainStations extends StatelessWidget {
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(context, index) {
|
(context, index) {
|
||||||
return IndexedSemantics(
|
return IndexedSemantics(
|
||||||
|
index: index,
|
||||||
child: DisplayTrainStation(
|
child: DisplayTrainStation(
|
||||||
station: trainData.stations[index],
|
station: trainData.stations[index],
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -805,7 +809,6 @@ class DisplayTrainStations extends StatelessWidget {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
index: index,
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
childCount: trainData.stations.length,
|
childCount: trainData.stations.length,
|
||||||
|
|
|
@ -7,7 +7,7 @@ class DisplayTrainStation extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
final void Function()? onTap;
|
final void Function()? onTap;
|
||||||
|
|
||||||
DisplayTrainStation({required this.station, this.onTap});
|
const DisplayTrainStation({required this.station, this.onTap});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -52,7 +52,7 @@ class DisplayTrainStation extends StatelessWidget {
|
||||||
|
|
||||||
final isDelayed = delay > 0 && real == true;
|
final isDelayed = delay > 0 && real == true;
|
||||||
final isOnTime = delay <= 0 && real == true;
|
final isOnTime = delay <= 0 && real == true;
|
||||||
final isNotScheduled = false;
|
const isNotScheduled = false;
|
||||||
|
|
||||||
return MaterialBadge(
|
return MaterialBadge(
|
||||||
text: station.km.toString(),
|
text: station.km.toString(),
|
||||||
|
@ -96,7 +96,7 @@ class DisplayTrainStation extends StatelessWidget {
|
||||||
class Title extends StatelessWidget {
|
class Title extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
|
|
||||||
Title({
|
const Title({
|
||||||
required this.station
|
required this.station
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class Title extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Text(
|
return Text(
|
||||||
station.name,
|
station.name,
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 18 : 22,
|
fontSize: isSmallScreen(context) ? 18 : 22,
|
||||||
fontWeight: MediaQuery.of(context).boldText ? FontWeight.w500 : FontWeight.w300,
|
fontWeight: MediaQuery.of(context).boldText ? FontWeight.w500 : FontWeight.w300,
|
||||||
// fontStyle: items[1] == "ONI" ? FontStyle.italic : FontStyle.normal,
|
// fontStyle: items[1] == "ONI" ? FontStyle.italic : FontStyle.normal,
|
||||||
|
@ -117,7 +117,7 @@ class Title extends StatelessWidget {
|
||||||
class Time extends StatelessWidget {
|
class Time extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
|
|
||||||
Time({
|
const Time({
|
||||||
required this.station,
|
required this.station,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ class Time extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"→",
|
"→",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 18 : 22,
|
fontSize: isSmallScreen(context) ? 18 : 22,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -157,7 +157,7 @@ class Time extends StatelessWidget {
|
||||||
Container(width: 2,),
|
Container(width: 2,),
|
||||||
Text(
|
Text(
|
||||||
"→",
|
"→",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 18 : 22,
|
fontSize: isSmallScreen(context) ? 18 : 22,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -170,7 +170,7 @@ class ArrivalTime extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
final bool finalStation;
|
final bool finalStation;
|
||||||
|
|
||||||
ArrivalTime({
|
const ArrivalTime({
|
||||||
required this.station,
|
required this.station,
|
||||||
this.finalStation = false,
|
this.finalStation = false,
|
||||||
});
|
});
|
||||||
|
@ -186,12 +186,12 @@ class ArrivalTime extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"→",
|
"→",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 18 : 22,
|
fontSize: isSmallScreen(context) ? 18 : 22,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(width: 2,),
|
Container(width: 2,),
|
||||||
Text("sosire la "),
|
const Text("sosire la "),
|
||||||
ArrivalTime(station: station,),
|
ArrivalTime(station: station,),
|
||||||
Expanded(child: Container(),),
|
Expanded(child: Container(),),
|
||||||
],
|
],
|
||||||
|
@ -213,13 +213,13 @@ class ArrivalTime extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"${oldDate.hour.toString().padLeft(2, '0')}:${oldDate.minute.toString().padLeft(2, '0')}",
|
"${oldDate.hour.toString().padLeft(2, '0')}:${oldDate.minute.toString().padLeft(2, '0')}",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
decoration: TextDecoration.lineThrough,
|
decoration: TextDecoration.lineThrough,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"${newDate.hour.toString().padLeft(2, '0')}:${newDate.minute.toString().padLeft(2, '0')}",
|
"${newDate.hour.toString().padLeft(2, '0')}:${newDate.minute.toString().padLeft(2, '0')}",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
color: Colors.red.shade300,
|
color: Colors.red.shade300,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -235,13 +235,13 @@ class ArrivalTime extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"${oldDate.hour.toString().padLeft(2, '0')}:${oldDate.minute.toString().padLeft(2, '0')}",
|
"${oldDate.hour.toString().padLeft(2, '0')}:${oldDate.minute.toString().padLeft(2, '0')}",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
decoration: TextDecoration.lineThrough,
|
decoration: TextDecoration.lineThrough,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"${newDate.hour.toString().padLeft(2, '0')}:${newDate.minute.toString().padLeft(2, '0')}",
|
"${newDate.hour.toString().padLeft(2, '0')}:${newDate.minute.toString().padLeft(2, '0')}",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
color: Colors.green.shade300,
|
color: Colors.green.shade300,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -255,7 +255,7 @@ class ArrivalTime extends StatelessWidget {
|
||||||
class StopTime extends StatelessWidget {
|
class StopTime extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
|
|
||||||
StopTime({
|
const StopTime({
|
||||||
required this.station,
|
required this.station,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ class StopTime extends StatelessWidget {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
const Text(
|
||||||
"staționează pentru",
|
"staționează pentru",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
@ -278,7 +278,7 @@ class StopTime extends StatelessWidget {
|
||||||
}
|
}
|
||||||
if (stopsForInt == 1) {
|
if (stopsForInt == 1) {
|
||||||
return Text(
|
return Text(
|
||||||
"1 " + (minutes ? 'minut' : 'secundă'),
|
"1 ${minutes ? 'minut' : 'secundă'}",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ class DepartureTime extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
final bool firstStation;
|
final bool firstStation;
|
||||||
|
|
||||||
DepartureTime({
|
const DepartureTime({
|
||||||
required this.station,
|
required this.station,
|
||||||
this.firstStation = false,
|
this.firstStation = false,
|
||||||
});
|
});
|
||||||
|
@ -320,12 +320,12 @@ class DepartureTime extends StatelessWidget {
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(child: Container(),),
|
Expanded(child: Container(),),
|
||||||
Text("plecare la "),
|
const Text("plecare la "),
|
||||||
DepartureTime(station: station,),
|
DepartureTime(station: station,),
|
||||||
Container(width: 2,),
|
Container(width: 2,),
|
||||||
Text(
|
Text(
|
||||||
"→",
|
"→",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -348,13 +348,13 @@ class DepartureTime extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"${oldDate.hour.toString().padLeft(2, '0')}:${oldDate.minute.toString().padLeft(2, '0')}",
|
"${oldDate.hour.toString().padLeft(2, '0')}:${oldDate.minute.toString().padLeft(2, '0')}",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
decoration: TextDecoration.lineThrough,
|
decoration: TextDecoration.lineThrough,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"${newDate.hour.toString().padLeft(2, '0')}:${newDate.minute.toString().padLeft(2, '0')}",
|
"${newDate.hour.toString().padLeft(2, '0')}:${newDate.minute.toString().padLeft(2, '0')}",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
color: Colors.red.shade300,
|
color: Colors.red.shade300,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -370,13 +370,13 @@ class DepartureTime extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"${oldDate.hour.toString().padLeft(2, '0')}:${oldDate.minute.toString().padLeft(2, '0')}",
|
"${oldDate.hour.toString().padLeft(2, '0')}:${oldDate.minute.toString().padLeft(2, '0')}",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
decoration: TextDecoration.lineThrough,
|
decoration: TextDecoration.lineThrough,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"${newDate.hour.toString().padLeft(2, '0')}:${newDate.minute.toString().padLeft(2, '0')}",
|
"${newDate.hour.toString().padLeft(2, '0')}:${newDate.minute.toString().padLeft(2, '0')}",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
color: Colors.green.shade300,
|
color: Colors.green.shade300,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -391,7 +391,7 @@ class DepartureTime extends StatelessWidget {
|
||||||
class Delay extends StatelessWidget {
|
class Delay extends StatelessWidget {
|
||||||
final Station station;
|
final Station station;
|
||||||
|
|
||||||
Delay({
|
const Delay({
|
||||||
required this.station,
|
required this.station,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -405,11 +405,12 @@ class Delay extends StatelessWidget {
|
||||||
delay = station.departure?.status?.delay;
|
delay = station.departure?.status?.delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delay == 0 || delay == null) return Container();
|
if (delay == 0 || delay == null) {
|
||||||
else if (delay > 0) {
|
return Container();
|
||||||
|
} else if (delay > 0) {
|
||||||
return Text(
|
return Text(
|
||||||
"$delay ${delay == 1 ? 'minut' : 'minute'} întârziere",
|
"$delay ${delay == 1 ? 'minut' : 'minute'} întârziere",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
color: Colors.red.shade300,
|
color: Colors.red.shade300,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
|
@ -419,7 +420,7 @@ class Delay extends StatelessWidget {
|
||||||
else if (delay < 0) {
|
else if (delay < 0) {
|
||||||
return Text(
|
return Text(
|
||||||
"${-delay} ${delay == -1 ? 'minut' : 'minute'} mai devreme",
|
"${-delay} ${delay == -1 ? 'minut' : 'minute'} mai devreme",
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
color: Colors.green.shade300,
|
color: Colors.green.shade300,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
|
|
|
@ -5,7 +5,7 @@ import 'package:info_tren/stations_list.dart.old';
|
||||||
class TrainInfoDisplayData extends StatelessWidget {
|
class TrainInfoDisplayData extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
TrainInfoDisplayData(this.trainData);
|
const TrainInfoDisplayData(this.trainData);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -57,11 +57,11 @@ class TrainInfoDisplayData extends StatelessWidget {
|
||||||
child: StationsList(trainData),
|
child: StationsList(trainData),
|
||||||
),
|
),
|
||||||
SafeArea(
|
SafeArea(
|
||||||
child: Container(),
|
|
||||||
bottom: true,
|
bottom: true,
|
||||||
left: false,
|
left: false,
|
||||||
right: false,
|
right: false,
|
||||||
top: false,
|
top: false,
|
||||||
|
child: Container(),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -72,20 +72,20 @@ class TrainInfoDisplayData extends StatelessWidget {
|
||||||
|
|
||||||
class TrainName extends StatelessWidget {
|
class TrainName extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
TrainName(this.trainData);
|
const TrainName(this.trainData);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Text(
|
return Text(
|
||||||
"${trainData.rank} ${trainData.number}",
|
"${trainData.rank} ${trainData.number}",
|
||||||
style: Theme.of(context).textTheme.headline3,
|
style: Theme.of(context).textTheme.displaySmall,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TrainRoute extends StatelessWidget {
|
class TrainRoute extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
TrainRoute(this.trainData);
|
const TrainRoute(this.trainData);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -95,19 +95,19 @@ class TrainRoute extends StatelessWidget {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
trainData.route.from,
|
trainData.route.from,
|
||||||
style: Theme.of(context).textTheme.bodyText1?.copyWith(fontStyle: FontStyle.italic),
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(fontStyle: FontStyle.italic),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"-",
|
"-",
|
||||||
style: Theme.of(context).textTheme.bodyText1?.copyWith(fontStyle: FontStyle.italic),
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(fontStyle: FontStyle.italic),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
trainData.route.to,
|
trainData.route.to,
|
||||||
style: Theme.of(context).textTheme.bodyText1?.copyWith(fontStyle: FontStyle.italic),
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(fontStyle: FontStyle.italic),
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -118,13 +118,13 @@ class TrainRoute extends StatelessWidget {
|
||||||
|
|
||||||
class TrainOperator extends StatelessWidget {
|
class TrainOperator extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
TrainOperator(this.trainData);
|
const TrainOperator(this.trainData);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Text(
|
return Text(
|
||||||
"Operat de ${trainData.operator}",
|
"Operat de ${trainData.operator}",
|
||||||
style: Theme.of(context).textTheme.bodyText2,
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -132,21 +132,21 @@ class TrainOperator extends StatelessWidget {
|
||||||
|
|
||||||
class TrainStatus extends StatelessWidget {
|
class TrainStatus extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
TrainStatus(this.trainData);
|
const TrainStatus(this.trainData);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Text(
|
return Text(
|
||||||
trainData.status.toString(),
|
trainData.status.toString(),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: Theme.of(context).textTheme.headline5,
|
style: Theme.of(context).textTheme.headlineSmall,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Destination extends StatelessWidget {
|
class Destination extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
Destination(this.trainData);
|
const Destination(this.trainData);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -169,7 +169,7 @@ class Destination extends StatelessWidget {
|
||||||
|
|
||||||
class LastUpdate extends StatelessWidget {
|
class LastUpdate extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
LastUpdate(this.trainData);
|
const LastUpdate(this.trainData);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -181,7 +181,7 @@ class LastUpdate extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(2.0),
|
padding: const EdgeInsets.all(2.0),
|
||||||
child: Text("Ultima informație", style: Theme.of(context).textTheme.headline5,),
|
child: Text("Ultima informație", style: Theme.of(context).textTheme.headlineSmall,),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -199,10 +199,10 @@ class LastUpdate extends StatelessWidget {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(2.0),
|
padding: const EdgeInsets.all(2.0),
|
||||||
child: trainData.status!.delay == 0
|
child: trainData.status!.delay == 0
|
||||||
? Text("Fără întârziere", style: Theme.of(context).textTheme.caption,)
|
? Text("Fără întârziere", style: Theme.of(context).textTheme.bodySmall,)
|
||||||
: trainData.status!.delay > 0
|
: trainData.status!.delay > 0
|
||||||
? Text("${trainData.status!.delay} minute întârziere", style: Theme.of(context).textTheme.bodyText2?.copyWith(color: Colors.red.shade700),)
|
? Text("${trainData.status!.delay} minute întârziere", style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: Colors.red.shade700),)
|
||||||
: Text("${-(trainData.status!.delay)} minute mai devreme", style: Theme.of(context).textTheme.bodyText2?.copyWith(color: Colors.green.shade700),)
|
: Text("${-(trainData.status!.delay)} minute mai devreme", style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: Colors.green.shade700),)
|
||||||
),
|
),
|
||||||
// TODO: Implement status report time detection
|
// TODO: Implement status report time detection
|
||||||
// Padding(
|
// Padding(
|
||||||
|
@ -247,7 +247,7 @@ class LastUpdate extends StatelessWidget {
|
||||||
|
|
||||||
class TotalDetails extends StatelessWidget {
|
class TotalDetails extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
TotalDetails(this.trainData);
|
const TotalDetails(this.trainData);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -255,7 +255,7 @@ class TotalDetails extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
'${trainData.stations.last.km} km',
|
'${trainData.stations.last.km} km',
|
||||||
style: Theme.of(context).textTheme.caption,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -278,7 +278,7 @@ class CustomDivider extends StatelessWidget {
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(height: 4,),
|
Container(height: 4,),
|
||||||
Divider(),
|
const Divider(),
|
||||||
Container(height: 4,),
|
Container(height: 4,),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,9 +2,12 @@ extension TakeWhile on String {
|
||||||
String takeWhile(Function charValidator) {
|
String takeWhile(Function charValidator) {
|
||||||
StringBuffer output = StringBuffer();
|
StringBuffer output = StringBuffer();
|
||||||
|
|
||||||
for (final char in this.codeUnits) {
|
for (final char in codeUnits) {
|
||||||
if (charValidator(char)) output.writeCharCode(char);
|
if (charValidator(char)) {
|
||||||
else break;
|
output.writeCharCode(char);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return output.toString();
|
return output.toString();
|
||||||
|
|
Loading…
Add table
Reference in a new issue