Compare commits
3 commits
50dd6c19c9
...
cb380e802c
| Author | SHA1 | Date | |
|---|---|---|---|
| cb380e802c | |||
| 2ac04cba02 | |||
| 6b33fcb01c |
66 changed files with 1992 additions and 644 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:info_tren/models/changelog_entry.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/utils/iterable_extensions.dart';
|
import 'package:info_tren/utils/iterable_extensions.dart';
|
||||||
|
|
||||||
Future<List<ChangelogEntry>> getRemoteReleases() async {
|
Future<List<ChangelogEntry>> getRemoteReleases() async {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import 'dart:convert';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:info_tren/api/common.dart';
|
import 'package:info_tren/api/common.dart';
|
||||||
import 'package:info_tren/models/station_data.dart';
|
import 'package:info_tren/models.dart';
|
||||||
|
|
||||||
Future<StationData> getStationData(String stationName) async {
|
Future<StationData> getStationData(String stationName) async {
|
||||||
final response = await http.get(Uri.https(authority, 'v3/stations/$stationName'));
|
final response = await http.get(Uri.https(authority, 'v3/stations/$stationName'));
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import 'dart:convert';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:info_tren/api/common.dart';
|
import 'package:info_tren/api/common.dart';
|
||||||
import 'package:info_tren/models/stations_result.dart';
|
import 'package:info_tren/models.dart';
|
||||||
|
|
||||||
Future<List<StationsResult>> get stations async {
|
Future<List<StationsResult>> get stations async {
|
||||||
final result = await http.get(Uri.https(authority, 'v2/stations'));
|
final result = await http.get(Uri.https(authority, 'v2/stations'));
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:info_tren/api/common.dart';
|
import 'package:info_tren/api/common.dart';
|
||||||
import 'package:info_tren/models/train_data.dart';
|
import 'package:info_tren/models.dart';
|
||||||
|
|
||||||
Future<TrainData> getTrain(String trainNumber, {DateTime? date}) async {
|
Future<TrainData> getTrain(String trainNumber, {DateTime? date}) async {
|
||||||
date ??= DateTime.now();
|
date ??= DateTime.now();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import 'dart:convert';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:info_tren/api/common.dart';
|
import 'package:info_tren/api/common.dart';
|
||||||
import 'package:info_tren/models/trains_result.dart';
|
import 'package:info_tren/models.dart';
|
||||||
|
|
||||||
Future<List<TrainsResult>> get trains async {
|
Future<List<TrainsResult>> get trains async {
|
||||||
final result = await http.get(Uri.https(authority, 'v2/trains'));
|
final result = await http.get(Uri.https(authority, 'v2/trains'));
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,13 @@ class MaterialBadge extends StatelessWidget {
|
||||||
final bool isOnTime;
|
final bool isOnTime;
|
||||||
final bool isDelayed;
|
final bool isDelayed;
|
||||||
|
|
||||||
MaterialBadge({
|
const MaterialBadge({
|
||||||
required this.text,
|
required this.text,
|
||||||
required this.caption,
|
required this.caption,
|
||||||
this.isNotScheduled = false,
|
this.isNotScheduled = false,
|
||||||
this.isOnTime = false,
|
this.isOnTime = false,
|
||||||
this.isDelayed = false,
|
this.isDelayed = false,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -56,7 +57,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 +68,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,30 +87,31 @@ 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,
|
||||||
this.isOnTime = false,
|
this.isOnTime = false,
|
||||||
this.isDelayed = false,
|
this.isDelayed = false,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Color foregroundColor = FOREGROUND_WHITE;
|
Color foregroundColor = foregroundWhite;
|
||||||
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(
|
||||||
|
|
@ -136,7 +138,7 @@ class CupertinoBadge extends StatelessWidget {
|
||||||
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: MediaQuery.of(context).boldText ? FontWeight.w400 : FontWeight.w200,
|
fontWeight: MediaQuery.of(context).boldText ? FontWeight.w400 : FontWeight.w200,
|
||||||
color: MediaQuery.of(context).boldText ? FOREGROUND_WHITE : foregroundColor,
|
color: MediaQuery.of(context).boldText ? foregroundWhite : foregroundColor,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
@ -146,7 +148,7 @@ class CupertinoBadge extends StatelessWidget {
|
||||||
caption,
|
caption,
|
||||||
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: MediaQuery.of(context).boldText ? FOREGROUND_WHITE : foregroundColor,
|
color: MediaQuery.of(context).boldText ? foregroundWhite : foregroundColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ 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 ?? foregroundDarkGrey,
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -33,8 +33,8 @@ 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 ?? foregroundDarkGrey,
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -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!,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:info_tren/models/ui_design.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';
|
||||||
|
|
||||||
class FutureDisplay<T> extends StatelessWidget {
|
class FutureDisplay<T> extends StatelessWidget {
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:info_tren/components/loading/loading_cupertino.dart';
|
import 'package:info_tren/components/loading/loading_cupertino.dart';
|
||||||
import 'package:info_tren/components/loading/loading_material.dart';
|
import 'package:info_tren/components/loading/loading_material.dart';
|
||||||
import 'package:info_tren/models/ui_design.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';
|
||||||
|
|
||||||
class Loading extends StatelessWidget {
|
class Loading extends StatelessWidget {
|
||||||
static const DEFAULT_TEXT = 'Loading...';
|
static const defaultText = 'Loading...';
|
||||||
|
|
||||||
final UiDesign? uiDesign;
|
final UiDesign? uiDesign;
|
||||||
final String? text;
|
final String? text;
|
||||||
|
|
@ -16,9 +16,9 @@ class Loading extends StatelessWidget {
|
||||||
final uiDesign = this.uiDesign ?? defaultUiDesign;
|
final uiDesign = this.uiDesign ?? defaultUiDesign;
|
||||||
switch (uiDesign) {
|
switch (uiDesign) {
|
||||||
case UiDesign.MATERIAL:
|
case UiDesign.MATERIAL:
|
||||||
return LoadingMaterial(text: text ?? DEFAULT_TEXT,);
|
return LoadingMaterial(text: text ?? defaultText,);
|
||||||
case UiDesign.CUPERTINO:
|
case UiDesign.CUPERTINO:
|
||||||
return LoadingCupertino(text: text ?? DEFAULT_TEXT,);
|
return LoadingCupertino(text: text ?? defaultText,);
|
||||||
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, super.key,});
|
||||||
}
|
}
|
||||||
|
|
@ -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 super.text, super.key,});
|
||||||
|
|
||||||
@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 super.text, super.key});
|
||||||
|
|
||||||
@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,12 +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/trains_result.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/models/ui_design.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;
|
||||||
|
|
@ -96,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(
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:info_tren/components/cupertino_divider.dart';
|
import 'package:info_tren/components/cupertino_divider.dart';
|
||||||
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions.dart';
|
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions.dart';
|
||||||
import 'package:info_tren/models/trains_result.dart';
|
import 'package:info_tren/models.dart';
|
||||||
|
|
||||||
class SelectTrainSuggestionsStateCupertino extends SelectTrainSuggestionsState {
|
class SelectTrainSuggestionsStateCupertino extends SelectTrainSuggestionsState {
|
||||||
@override
|
@override
|
||||||
|
|
@ -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(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions.dart';
|
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions.dart';
|
||||||
import 'package:info_tren/models/trains_result.dart';
|
import 'package:info_tren/models.dart';
|
||||||
|
|
||||||
class SelectTrainSuggestionsStateMaterial extends SelectTrainSuggestionsState {
|
class SelectTrainSuggestionsStateMaterial extends SelectTrainSuggestionsState {
|
||||||
@override
|
@override
|
||||||
|
|
@ -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,10 +5,11 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -28,11 +29,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 +44,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,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
||||||
class SliverPersistentHeaderPadding extends StatelessWidget {
|
class SliverPersistentHeaderPadding extends StatelessWidget {
|
||||||
final double maxHeight;
|
final double maxHeight;
|
||||||
|
|
||||||
const SliverPersistentHeaderPadding({required this.maxHeight});
|
const SliverPersistentHeaderPadding({required this.maxHeight, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
import 'dart:io' show Platform;
|
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:info_tren/models.dart';
|
||||||
// import 'package:flutter_redux/flutter_redux.dart';
|
|
||||||
import 'package:info_tren/models/ui_design.dart';
|
|
||||||
import 'package:info_tren/pages/about/about_page.dart';
|
import 'package:info_tren/pages/about/about_page.dart';
|
||||||
import 'package:info_tren/pages/main/main_page.dart';
|
import 'package:info_tren/pages/main/main_page.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';
|
||||||
|
|
@ -15,15 +11,8 @@ import 'package:info_tren/pages/train_info_page/select_train/select_train.dart';
|
||||||
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
// final store = createStore();
|
|
||||||
// runApp(
|
|
||||||
// StoreProvider(
|
|
||||||
// store: store,
|
|
||||||
// child: StartPoint(),
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
runApp(
|
runApp(
|
||||||
StartPoint(),
|
const StartPoint(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,6 +56,8 @@ Map<String, WidgetBuilder> routesByUiDesign(UiDesign uiDesign) => {
|
||||||
class StartPoint extends StatelessWidget {
|
class StartPoint extends StatelessWidget {
|
||||||
final String appTitle = 'Info Tren';
|
final String appTitle = 'Info Tren';
|
||||||
|
|
||||||
|
const StartPoint({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// if (Platform.isIOS || Platform.isMacOS) {
|
// if (Platform.isIOS || Platform.isMacOS) {
|
||||||
|
|
|
||||||
13
lib/models.dart
Normal file
13
lib/models.dart
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
export 'package:info_tren/models/changelog_entry.dart';
|
||||||
|
export 'package:info_tren/models/station_arrdep.dart';
|
||||||
|
export 'package:info_tren/models/station_data.dart';
|
||||||
|
export 'package:info_tren/models/station_status.dart';
|
||||||
|
export 'package:info_tren/models/station_train.dart';
|
||||||
|
export 'package:info_tren/models/stations_result.dart';
|
||||||
|
export 'package:info_tren/models/train_data.dart' hide State;
|
||||||
|
export 'package:info_tren/models/trains_result.dart';
|
||||||
|
export 'package:info_tren/models/ui_design.dart';
|
||||||
|
|
||||||
|
import 'package:info_tren/models/train_data.dart' show State;
|
||||||
|
|
||||||
|
typedef TrainDataState = State;
|
||||||
18
lib/models/station_arrdep.dart
Normal file
18
lib/models/station_arrdep.dart
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:info_tren/models.dart';
|
||||||
|
|
||||||
|
part 'station_arrdep.g.dart';
|
||||||
|
part 'station_arrdep.freezed.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class StationArrDep with _$StationArrDep {
|
||||||
|
const factory StationArrDep({
|
||||||
|
required int? stoppingTime,
|
||||||
|
required DateTime time,
|
||||||
|
required StationTrain train,
|
||||||
|
required StationStatus status,
|
||||||
|
}) = _StationArrDep;
|
||||||
|
|
||||||
|
factory StationArrDep.fromJson(Map<String, dynamic> json) => _$StationArrDepFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
241
lib/models/station_arrdep.freezed.dart
Normal file
241
lib/models/station_arrdep.freezed.dart
Normal file
|
|
@ -0,0 +1,241 @@
|
||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
|
||||||
|
|
||||||
|
part of 'station_arrdep.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
|
||||||
|
|
||||||
|
StationArrDep _$StationArrDepFromJson(Map<String, dynamic> json) {
|
||||||
|
return _StationArrDep.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$StationArrDep {
|
||||||
|
int? get stoppingTime => throw _privateConstructorUsedError;
|
||||||
|
DateTime get time => throw _privateConstructorUsedError;
|
||||||
|
StationTrain get train => throw _privateConstructorUsedError;
|
||||||
|
StationStatus get status => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$StationArrDepCopyWith<StationArrDep> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $StationArrDepCopyWith<$Res> {
|
||||||
|
factory $StationArrDepCopyWith(
|
||||||
|
StationArrDep value, $Res Function(StationArrDep) then) =
|
||||||
|
_$StationArrDepCopyWithImpl<$Res, StationArrDep>;
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{int? stoppingTime,
|
||||||
|
DateTime time,
|
||||||
|
StationTrain train,
|
||||||
|
StationStatus status});
|
||||||
|
|
||||||
|
$StationTrainCopyWith<$Res> get train;
|
||||||
|
$StationStatusCopyWith<$Res> get status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$StationArrDepCopyWithImpl<$Res, $Val extends StationArrDep>
|
||||||
|
implements $StationArrDepCopyWith<$Res> {
|
||||||
|
_$StationArrDepCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? stoppingTime = freezed,
|
||||||
|
Object? time = null,
|
||||||
|
Object? train = null,
|
||||||
|
Object? status = null,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
stoppingTime: freezed == stoppingTime
|
||||||
|
? _value.stoppingTime
|
||||||
|
: stoppingTime // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
time: null == time
|
||||||
|
? _value.time
|
||||||
|
: time // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
train: null == train
|
||||||
|
? _value.train
|
||||||
|
: train // ignore: cast_nullable_to_non_nullable
|
||||||
|
as StationTrain,
|
||||||
|
status: null == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as StationStatus,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$StationTrainCopyWith<$Res> get train {
|
||||||
|
return $StationTrainCopyWith<$Res>(_value.train, (value) {
|
||||||
|
return _then(_value.copyWith(train: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$StationStatusCopyWith<$Res> get status {
|
||||||
|
return $StationStatusCopyWith<$Res>(_value.status, (value) {
|
||||||
|
return _then(_value.copyWith(status: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$_StationArrDepCopyWith<$Res>
|
||||||
|
implements $StationArrDepCopyWith<$Res> {
|
||||||
|
factory _$$_StationArrDepCopyWith(
|
||||||
|
_$_StationArrDep value, $Res Function(_$_StationArrDep) then) =
|
||||||
|
__$$_StationArrDepCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{int? stoppingTime,
|
||||||
|
DateTime time,
|
||||||
|
StationTrain train,
|
||||||
|
StationStatus status});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$StationTrainCopyWith<$Res> get train;
|
||||||
|
@override
|
||||||
|
$StationStatusCopyWith<$Res> get status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$_StationArrDepCopyWithImpl<$Res>
|
||||||
|
extends _$StationArrDepCopyWithImpl<$Res, _$_StationArrDep>
|
||||||
|
implements _$$_StationArrDepCopyWith<$Res> {
|
||||||
|
__$$_StationArrDepCopyWithImpl(
|
||||||
|
_$_StationArrDep _value, $Res Function(_$_StationArrDep) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? stoppingTime = freezed,
|
||||||
|
Object? time = null,
|
||||||
|
Object? train = null,
|
||||||
|
Object? status = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$_StationArrDep(
|
||||||
|
stoppingTime: freezed == stoppingTime
|
||||||
|
? _value.stoppingTime
|
||||||
|
: stoppingTime // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
time: null == time
|
||||||
|
? _value.time
|
||||||
|
: time // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
train: null == train
|
||||||
|
? _value.train
|
||||||
|
: train // ignore: cast_nullable_to_non_nullable
|
||||||
|
as StationTrain,
|
||||||
|
status: null == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as StationStatus,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$_StationArrDep implements _StationArrDep {
|
||||||
|
const _$_StationArrDep(
|
||||||
|
{required this.stoppingTime,
|
||||||
|
required this.time,
|
||||||
|
required this.train,
|
||||||
|
required this.status});
|
||||||
|
|
||||||
|
factory _$_StationArrDep.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$_StationArrDepFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final int? stoppingTime;
|
||||||
|
@override
|
||||||
|
final DateTime time;
|
||||||
|
@override
|
||||||
|
final StationTrain train;
|
||||||
|
@override
|
||||||
|
final StationStatus status;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StationArrDep(stoppingTime: $stoppingTime, time: $time, train: $train, status: $status)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(dynamic other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$_StationArrDep &&
|
||||||
|
(identical(other.stoppingTime, stoppingTime) ||
|
||||||
|
other.stoppingTime == stoppingTime) &&
|
||||||
|
(identical(other.time, time) || other.time == time) &&
|
||||||
|
(identical(other.train, train) || other.train == train) &&
|
||||||
|
(identical(other.status, status) || other.status == status));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
Object.hash(runtimeType, stoppingTime, time, train, status);
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$_StationArrDepCopyWith<_$_StationArrDep> get copyWith =>
|
||||||
|
__$$_StationArrDepCopyWithImpl<_$_StationArrDep>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$_StationArrDepToJson(
|
||||||
|
this,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _StationArrDep implements StationArrDep {
|
||||||
|
const factory _StationArrDep(
|
||||||
|
{required final int? stoppingTime,
|
||||||
|
required final DateTime time,
|
||||||
|
required final StationTrain train,
|
||||||
|
required final StationStatus status}) = _$_StationArrDep;
|
||||||
|
|
||||||
|
factory _StationArrDep.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$_StationArrDep.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int? get stoppingTime;
|
||||||
|
@override
|
||||||
|
DateTime get time;
|
||||||
|
@override
|
||||||
|
StationTrain get train;
|
||||||
|
@override
|
||||||
|
StationStatus get status;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$_StationArrDepCopyWith<_$_StationArrDep> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
23
lib/models/station_arrdep.g.dart
Normal file
23
lib/models/station_arrdep.g.dart
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'station_arrdep.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_$_StationArrDep _$$_StationArrDepFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$_StationArrDep(
|
||||||
|
stoppingTime: json['stoppingTime'] as int?,
|
||||||
|
time: DateTime.parse(json['time'] as String),
|
||||||
|
train: StationTrain.fromJson(json['train'] as Map<String, dynamic>),
|
||||||
|
status: StationStatus.fromJson(json['status'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$_StationArrDepToJson(_$_StationArrDep instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'stoppingTime': instance.stoppingTime,
|
||||||
|
'time': instance.time.toIso8601String(),
|
||||||
|
'train': instance.train,
|
||||||
|
'status': instance.status,
|
||||||
|
};
|
||||||
|
|
@ -1,64 +1,17 @@
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:info_tren/models.dart';
|
||||||
|
|
||||||
part 'station_data.g.dart';
|
part 'station_data.g.dart';
|
||||||
|
part 'station_data.freezed.dart';
|
||||||
|
|
||||||
@JsonSerializable()
|
@freezed
|
||||||
class StationData {
|
class StationData with _$StationData {
|
||||||
final String date;
|
const factory StationData({
|
||||||
final String stationName;
|
required String date,
|
||||||
final List<StationArrDep>? arrivals;
|
required String stationName,
|
||||||
final List<StationArrDep>? departures;
|
required List<StationArrDep>? arrivals,
|
||||||
|
required List<StationArrDep>? departures,
|
||||||
const StationData({required this.date, required this.stationName, required this.arrivals, required this.departures});
|
}) = _StationData;
|
||||||
|
|
||||||
factory StationData.fromJson(Map<String, dynamic> json) => _$StationDataFromJson(json);
|
factory StationData.fromJson(Map<String, dynamic> json) => _$StationDataFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$StationDataToJson(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
class StationArrDep {
|
|
||||||
final int? stoppingTime;
|
|
||||||
final DateTime time;
|
|
||||||
final StationTrain train;
|
|
||||||
final StationStatus status;
|
|
||||||
|
|
||||||
const StationArrDep({required this.stoppingTime, required this.time, required this.train, required this.status,});
|
|
||||||
|
|
||||||
factory StationArrDep.fromJson(Map<String, dynamic> json) => _$StationArrDepFromJson(json);
|
|
||||||
Map<String, dynamic> toJson() => _$StationArrDepToJson(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
class StationTrain {
|
|
||||||
final String rank;
|
|
||||||
final String number;
|
|
||||||
final String operator;
|
|
||||||
final String terminus;
|
|
||||||
final List<String>? route;
|
|
||||||
final DateTime departureDate;
|
|
||||||
|
|
||||||
StationTrain({
|
|
||||||
required this.rank,
|
|
||||||
required this.number,
|
|
||||||
required this.operator,
|
|
||||||
required this.terminus,
|
|
||||||
this.route,
|
|
||||||
required this.departureDate,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory StationTrain.fromJson(Map<String, dynamic> json) => _$StationTrainFromJson(json);
|
|
||||||
Map<String, dynamic> toJson() => _$StationTrainToJson(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
class StationStatus {
|
|
||||||
final int delay;
|
|
||||||
final bool real;
|
|
||||||
final bool cancelled;
|
|
||||||
final String? platform;
|
|
||||||
|
|
||||||
StationStatus({required this.delay, required this.real, required this.cancelled, required this.platform});
|
|
||||||
|
|
||||||
factory StationStatus.fromJson(Map<String, dynamic> json) => _$StationStatusFromJson(json);
|
|
||||||
Map<String, dynamic> toJson() => _$StationStatusToJson(this);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
237
lib/models/station_data.freezed.dart
Normal file
237
lib/models/station_data.freezed.dart
Normal file
|
|
@ -0,0 +1,237 @@
|
||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
|
||||||
|
|
||||||
|
part of 'station_data.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
|
||||||
|
|
||||||
|
StationData _$StationDataFromJson(Map<String, dynamic> json) {
|
||||||
|
return _StationData.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$StationData {
|
||||||
|
String get date => throw _privateConstructorUsedError;
|
||||||
|
String get stationName => throw _privateConstructorUsedError;
|
||||||
|
List<StationArrDep>? get arrivals => throw _privateConstructorUsedError;
|
||||||
|
List<StationArrDep>? get departures => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$StationDataCopyWith<StationData> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $StationDataCopyWith<$Res> {
|
||||||
|
factory $StationDataCopyWith(
|
||||||
|
StationData value, $Res Function(StationData) then) =
|
||||||
|
_$StationDataCopyWithImpl<$Res, StationData>;
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{String date,
|
||||||
|
String stationName,
|
||||||
|
List<StationArrDep>? arrivals,
|
||||||
|
List<StationArrDep>? departures});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$StationDataCopyWithImpl<$Res, $Val extends StationData>
|
||||||
|
implements $StationDataCopyWith<$Res> {
|
||||||
|
_$StationDataCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? date = null,
|
||||||
|
Object? stationName = null,
|
||||||
|
Object? arrivals = freezed,
|
||||||
|
Object? departures = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
date: null == date
|
||||||
|
? _value.date
|
||||||
|
: date // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
stationName: null == stationName
|
||||||
|
? _value.stationName
|
||||||
|
: stationName // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
arrivals: freezed == arrivals
|
||||||
|
? _value.arrivals
|
||||||
|
: arrivals // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<StationArrDep>?,
|
||||||
|
departures: freezed == departures
|
||||||
|
? _value.departures
|
||||||
|
: departures // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<StationArrDep>?,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$_StationDataCopyWith<$Res>
|
||||||
|
implements $StationDataCopyWith<$Res> {
|
||||||
|
factory _$$_StationDataCopyWith(
|
||||||
|
_$_StationData value, $Res Function(_$_StationData) then) =
|
||||||
|
__$$_StationDataCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{String date,
|
||||||
|
String stationName,
|
||||||
|
List<StationArrDep>? arrivals,
|
||||||
|
List<StationArrDep>? departures});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$_StationDataCopyWithImpl<$Res>
|
||||||
|
extends _$StationDataCopyWithImpl<$Res, _$_StationData>
|
||||||
|
implements _$$_StationDataCopyWith<$Res> {
|
||||||
|
__$$_StationDataCopyWithImpl(
|
||||||
|
_$_StationData _value, $Res Function(_$_StationData) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? date = null,
|
||||||
|
Object? stationName = null,
|
||||||
|
Object? arrivals = freezed,
|
||||||
|
Object? departures = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(_$_StationData(
|
||||||
|
date: null == date
|
||||||
|
? _value.date
|
||||||
|
: date // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
stationName: null == stationName
|
||||||
|
? _value.stationName
|
||||||
|
: stationName // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
arrivals: freezed == arrivals
|
||||||
|
? _value._arrivals
|
||||||
|
: arrivals // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<StationArrDep>?,
|
||||||
|
departures: freezed == departures
|
||||||
|
? _value._departures
|
||||||
|
: departures // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<StationArrDep>?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$_StationData implements _StationData {
|
||||||
|
const _$_StationData(
|
||||||
|
{required this.date,
|
||||||
|
required this.stationName,
|
||||||
|
required final List<StationArrDep>? arrivals,
|
||||||
|
required final List<StationArrDep>? departures})
|
||||||
|
: _arrivals = arrivals,
|
||||||
|
_departures = departures;
|
||||||
|
|
||||||
|
factory _$_StationData.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$_StationDataFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String date;
|
||||||
|
@override
|
||||||
|
final String stationName;
|
||||||
|
final List<StationArrDep>? _arrivals;
|
||||||
|
@override
|
||||||
|
List<StationArrDep>? get arrivals {
|
||||||
|
final value = _arrivals;
|
||||||
|
if (value == null) return null;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<StationArrDep>? _departures;
|
||||||
|
@override
|
||||||
|
List<StationArrDep>? get departures {
|
||||||
|
final value = _departures;
|
||||||
|
if (value == null) return null;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StationData(date: $date, stationName: $stationName, arrivals: $arrivals, departures: $departures)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(dynamic other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$_StationData &&
|
||||||
|
(identical(other.date, date) || other.date == date) &&
|
||||||
|
(identical(other.stationName, stationName) ||
|
||||||
|
other.stationName == stationName) &&
|
||||||
|
const DeepCollectionEquality().equals(other._arrivals, _arrivals) &&
|
||||||
|
const DeepCollectionEquality()
|
||||||
|
.equals(other._departures, _departures));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
date,
|
||||||
|
stationName,
|
||||||
|
const DeepCollectionEquality().hash(_arrivals),
|
||||||
|
const DeepCollectionEquality().hash(_departures));
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$_StationDataCopyWith<_$_StationData> get copyWith =>
|
||||||
|
__$$_StationDataCopyWithImpl<_$_StationData>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$_StationDataToJson(
|
||||||
|
this,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _StationData implements StationData {
|
||||||
|
const factory _StationData(
|
||||||
|
{required final String date,
|
||||||
|
required final String stationName,
|
||||||
|
required final List<StationArrDep>? arrivals,
|
||||||
|
required final List<StationArrDep>? departures}) = _$_StationData;
|
||||||
|
|
||||||
|
factory _StationData.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$_StationData.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get date;
|
||||||
|
@override
|
||||||
|
String get stationName;
|
||||||
|
@override
|
||||||
|
List<StationArrDep>? get arrivals;
|
||||||
|
@override
|
||||||
|
List<StationArrDep>? get departures;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$_StationDataCopyWith<_$_StationData> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,8 @@ part of 'station_data.dart';
|
||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
StationData _$StationDataFromJson(Map<String, dynamic> json) => StationData(
|
_$_StationData _$$_StationDataFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$_StationData(
|
||||||
date: json['date'] as String,
|
date: json['date'] as String,
|
||||||
stationName: json['stationName'] as String,
|
stationName: json['stationName'] as String,
|
||||||
arrivals: (json['arrivals'] as List<dynamic>?)
|
arrivals: (json['arrivals'] as List<dynamic>?)
|
||||||
|
|
@ -17,62 +18,10 @@ StationData _$StationDataFromJson(Map<String, dynamic> json) => StationData(
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$StationDataToJson(StationData instance) =>
|
Map<String, dynamic> _$$_StationDataToJson(_$_StationData instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'date': instance.date,
|
'date': instance.date,
|
||||||
'stationName': instance.stationName,
|
'stationName': instance.stationName,
|
||||||
'arrivals': instance.arrivals,
|
'arrivals': instance.arrivals,
|
||||||
'departures': instance.departures,
|
'departures': instance.departures,
|
||||||
};
|
};
|
||||||
|
|
||||||
StationArrDep _$StationArrDepFromJson(Map<String, dynamic> json) =>
|
|
||||||
StationArrDep(
|
|
||||||
stoppingTime: json['stoppingTime'] as int?,
|
|
||||||
time: DateTime.parse(json['time'] as String),
|
|
||||||
train: StationTrain.fromJson(json['train'] as Map<String, dynamic>),
|
|
||||||
status: StationStatus.fromJson(json['status'] as Map<String, dynamic>),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$StationArrDepToJson(StationArrDep instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'stoppingTime': instance.stoppingTime,
|
|
||||||
'time': instance.time.toIso8601String(),
|
|
||||||
'train': instance.train,
|
|
||||||
'status': instance.status,
|
|
||||||
};
|
|
||||||
|
|
||||||
StationTrain _$StationTrainFromJson(Map<String, dynamic> json) => StationTrain(
|
|
||||||
rank: json['rank'] as String,
|
|
||||||
number: json['number'] as String,
|
|
||||||
operator: json['operator'] as String,
|
|
||||||
terminus: json['terminus'] as String,
|
|
||||||
route:
|
|
||||||
(json['route'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
|
||||||
departureDate: DateTime.parse(json['departureDate'] as String),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$StationTrainToJson(StationTrain instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'rank': instance.rank,
|
|
||||||
'number': instance.number,
|
|
||||||
'operator': instance.operator,
|
|
||||||
'terminus': instance.terminus,
|
|
||||||
'route': instance.route,
|
|
||||||
'departureDate': instance.departureDate.toIso8601String(),
|
|
||||||
};
|
|
||||||
|
|
||||||
StationStatus _$StationStatusFromJson(Map<String, dynamic> json) =>
|
|
||||||
StationStatus(
|
|
||||||
delay: json['delay'] as int,
|
|
||||||
real: json['real'] as bool,
|
|
||||||
cancelled: json['cancelled'] as bool,
|
|
||||||
platform: json['platform'] as String?,
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$StationStatusToJson(StationStatus instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'delay': instance.delay,
|
|
||||||
'real': instance.real,
|
|
||||||
'cancelled': instance.cancelled,
|
|
||||||
'platform': instance.platform,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
17
lib/models/station_status.dart
Normal file
17
lib/models/station_status.dart
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'station_status.g.dart';
|
||||||
|
part 'station_status.freezed.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class StationStatus with _$StationStatus {
|
||||||
|
const factory StationStatus({
|
||||||
|
required int delay,
|
||||||
|
required bool real,
|
||||||
|
required bool cancelled,
|
||||||
|
required String? platform,
|
||||||
|
}) = _StationStatus;
|
||||||
|
|
||||||
|
factory StationStatus.fromJson(Map<String, dynamic> json) => _$StationStatusFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
210
lib/models/station_status.freezed.dart
Normal file
210
lib/models/station_status.freezed.dart
Normal file
|
|
@ -0,0 +1,210 @@
|
||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
|
||||||
|
|
||||||
|
part of 'station_status.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
|
||||||
|
|
||||||
|
StationStatus _$StationStatusFromJson(Map<String, dynamic> json) {
|
||||||
|
return _StationStatus.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$StationStatus {
|
||||||
|
int get delay => throw _privateConstructorUsedError;
|
||||||
|
bool get real => throw _privateConstructorUsedError;
|
||||||
|
bool get cancelled => throw _privateConstructorUsedError;
|
||||||
|
String? get platform => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$StationStatusCopyWith<StationStatus> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $StationStatusCopyWith<$Res> {
|
||||||
|
factory $StationStatusCopyWith(
|
||||||
|
StationStatus value, $Res Function(StationStatus) then) =
|
||||||
|
_$StationStatusCopyWithImpl<$Res, StationStatus>;
|
||||||
|
@useResult
|
||||||
|
$Res call({int delay, bool real, bool cancelled, String? platform});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$StationStatusCopyWithImpl<$Res, $Val extends StationStatus>
|
||||||
|
implements $StationStatusCopyWith<$Res> {
|
||||||
|
_$StationStatusCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? delay = null,
|
||||||
|
Object? real = null,
|
||||||
|
Object? cancelled = null,
|
||||||
|
Object? platform = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
delay: null == delay
|
||||||
|
? _value.delay
|
||||||
|
: delay // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
real: null == real
|
||||||
|
? _value.real
|
||||||
|
: real // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
cancelled: null == cancelled
|
||||||
|
? _value.cancelled
|
||||||
|
: cancelled // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
platform: freezed == platform
|
||||||
|
? _value.platform
|
||||||
|
: platform // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$_StationStatusCopyWith<$Res>
|
||||||
|
implements $StationStatusCopyWith<$Res> {
|
||||||
|
factory _$$_StationStatusCopyWith(
|
||||||
|
_$_StationStatus value, $Res Function(_$_StationStatus) then) =
|
||||||
|
__$$_StationStatusCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({int delay, bool real, bool cancelled, String? platform});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$_StationStatusCopyWithImpl<$Res>
|
||||||
|
extends _$StationStatusCopyWithImpl<$Res, _$_StationStatus>
|
||||||
|
implements _$$_StationStatusCopyWith<$Res> {
|
||||||
|
__$$_StationStatusCopyWithImpl(
|
||||||
|
_$_StationStatus _value, $Res Function(_$_StationStatus) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? delay = null,
|
||||||
|
Object? real = null,
|
||||||
|
Object? cancelled = null,
|
||||||
|
Object? platform = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(_$_StationStatus(
|
||||||
|
delay: null == delay
|
||||||
|
? _value.delay
|
||||||
|
: delay // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
real: null == real
|
||||||
|
? _value.real
|
||||||
|
: real // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
cancelled: null == cancelled
|
||||||
|
? _value.cancelled
|
||||||
|
: cancelled // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
platform: freezed == platform
|
||||||
|
? _value.platform
|
||||||
|
: platform // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$_StationStatus implements _StationStatus {
|
||||||
|
const _$_StationStatus(
|
||||||
|
{required this.delay,
|
||||||
|
required this.real,
|
||||||
|
required this.cancelled,
|
||||||
|
required this.platform});
|
||||||
|
|
||||||
|
factory _$_StationStatus.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$_StationStatusFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final int delay;
|
||||||
|
@override
|
||||||
|
final bool real;
|
||||||
|
@override
|
||||||
|
final bool cancelled;
|
||||||
|
@override
|
||||||
|
final String? platform;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StationStatus(delay: $delay, real: $real, cancelled: $cancelled, platform: $platform)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(dynamic other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$_StationStatus &&
|
||||||
|
(identical(other.delay, delay) || other.delay == delay) &&
|
||||||
|
(identical(other.real, real) || other.real == real) &&
|
||||||
|
(identical(other.cancelled, cancelled) ||
|
||||||
|
other.cancelled == cancelled) &&
|
||||||
|
(identical(other.platform, platform) ||
|
||||||
|
other.platform == platform));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
Object.hash(runtimeType, delay, real, cancelled, platform);
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$_StationStatusCopyWith<_$_StationStatus> get copyWith =>
|
||||||
|
__$$_StationStatusCopyWithImpl<_$_StationStatus>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$_StationStatusToJson(
|
||||||
|
this,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _StationStatus implements StationStatus {
|
||||||
|
const factory _StationStatus(
|
||||||
|
{required final int delay,
|
||||||
|
required final bool real,
|
||||||
|
required final bool cancelled,
|
||||||
|
required final String? platform}) = _$_StationStatus;
|
||||||
|
|
||||||
|
factory _StationStatus.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$_StationStatus.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get delay;
|
||||||
|
@override
|
||||||
|
bool get real;
|
||||||
|
@override
|
||||||
|
bool get cancelled;
|
||||||
|
@override
|
||||||
|
String? get platform;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$_StationStatusCopyWith<_$_StationStatus> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
23
lib/models/station_status.g.dart
Normal file
23
lib/models/station_status.g.dart
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'station_status.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_$_StationStatus _$$_StationStatusFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$_StationStatus(
|
||||||
|
delay: json['delay'] as int,
|
||||||
|
real: json['real'] as bool,
|
||||||
|
cancelled: json['cancelled'] as bool,
|
||||||
|
platform: json['platform'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$_StationStatusToJson(_$_StationStatus instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'delay': instance.delay,
|
||||||
|
'real': instance.real,
|
||||||
|
'cancelled': instance.cancelled,
|
||||||
|
'platform': instance.platform,
|
||||||
|
};
|
||||||
19
lib/models/station_train.dart
Normal file
19
lib/models/station_train.dart
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'station_train.g.dart';
|
||||||
|
part 'station_train.freezed.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class StationTrain with _$StationTrain {
|
||||||
|
const factory StationTrain({
|
||||||
|
required String rank,
|
||||||
|
required String number,
|
||||||
|
required String operator,
|
||||||
|
required String terminus,
|
||||||
|
List<String>? route,
|
||||||
|
required DateTime departureDate,
|
||||||
|
}) = _StationTrain;
|
||||||
|
|
||||||
|
factory StationTrain.fromJson(Map<String, dynamic> json) => _$StationTrainFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
267
lib/models/station_train.freezed.dart
Normal file
267
lib/models/station_train.freezed.dart
Normal file
|
|
@ -0,0 +1,267 @@
|
||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
|
||||||
|
|
||||||
|
part of 'station_train.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
|
||||||
|
|
||||||
|
StationTrain _$StationTrainFromJson(Map<String, dynamic> json) {
|
||||||
|
return _StationTrain.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$StationTrain {
|
||||||
|
String get rank => throw _privateConstructorUsedError;
|
||||||
|
String get number => throw _privateConstructorUsedError;
|
||||||
|
String get operator => throw _privateConstructorUsedError;
|
||||||
|
String get terminus => throw _privateConstructorUsedError;
|
||||||
|
List<String>? get route => throw _privateConstructorUsedError;
|
||||||
|
DateTime get departureDate => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$StationTrainCopyWith<StationTrain> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $StationTrainCopyWith<$Res> {
|
||||||
|
factory $StationTrainCopyWith(
|
||||||
|
StationTrain value, $Res Function(StationTrain) then) =
|
||||||
|
_$StationTrainCopyWithImpl<$Res, StationTrain>;
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{String rank,
|
||||||
|
String number,
|
||||||
|
String operator,
|
||||||
|
String terminus,
|
||||||
|
List<String>? route,
|
||||||
|
DateTime departureDate});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$StationTrainCopyWithImpl<$Res, $Val extends StationTrain>
|
||||||
|
implements $StationTrainCopyWith<$Res> {
|
||||||
|
_$StationTrainCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? rank = null,
|
||||||
|
Object? number = null,
|
||||||
|
Object? operator = null,
|
||||||
|
Object? terminus = null,
|
||||||
|
Object? route = freezed,
|
||||||
|
Object? departureDate = null,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
rank: null == rank
|
||||||
|
? _value.rank
|
||||||
|
: rank // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
number: null == number
|
||||||
|
? _value.number
|
||||||
|
: number // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
operator: null == operator
|
||||||
|
? _value.operator
|
||||||
|
: operator // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
terminus: null == terminus
|
||||||
|
? _value.terminus
|
||||||
|
: terminus // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
route: freezed == route
|
||||||
|
? _value.route
|
||||||
|
: route // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,
|
||||||
|
departureDate: null == departureDate
|
||||||
|
? _value.departureDate
|
||||||
|
: departureDate // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$_StationTrainCopyWith<$Res>
|
||||||
|
implements $StationTrainCopyWith<$Res> {
|
||||||
|
factory _$$_StationTrainCopyWith(
|
||||||
|
_$_StationTrain value, $Res Function(_$_StationTrain) then) =
|
||||||
|
__$$_StationTrainCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{String rank,
|
||||||
|
String number,
|
||||||
|
String operator,
|
||||||
|
String terminus,
|
||||||
|
List<String>? route,
|
||||||
|
DateTime departureDate});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$_StationTrainCopyWithImpl<$Res>
|
||||||
|
extends _$StationTrainCopyWithImpl<$Res, _$_StationTrain>
|
||||||
|
implements _$$_StationTrainCopyWith<$Res> {
|
||||||
|
__$$_StationTrainCopyWithImpl(
|
||||||
|
_$_StationTrain _value, $Res Function(_$_StationTrain) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? rank = null,
|
||||||
|
Object? number = null,
|
||||||
|
Object? operator = null,
|
||||||
|
Object? terminus = null,
|
||||||
|
Object? route = freezed,
|
||||||
|
Object? departureDate = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$_StationTrain(
|
||||||
|
rank: null == rank
|
||||||
|
? _value.rank
|
||||||
|
: rank // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
number: null == number
|
||||||
|
? _value.number
|
||||||
|
: number // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
operator: null == operator
|
||||||
|
? _value.operator
|
||||||
|
: operator // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
terminus: null == terminus
|
||||||
|
? _value.terminus
|
||||||
|
: terminus // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
route: freezed == route
|
||||||
|
? _value._route
|
||||||
|
: route // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,
|
||||||
|
departureDate: null == departureDate
|
||||||
|
? _value.departureDate
|
||||||
|
: departureDate // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$_StationTrain implements _StationTrain {
|
||||||
|
const _$_StationTrain(
|
||||||
|
{required this.rank,
|
||||||
|
required this.number,
|
||||||
|
required this.operator,
|
||||||
|
required this.terminus,
|
||||||
|
final List<String>? route,
|
||||||
|
required this.departureDate})
|
||||||
|
: _route = route;
|
||||||
|
|
||||||
|
factory _$_StationTrain.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$_StationTrainFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String rank;
|
||||||
|
@override
|
||||||
|
final String number;
|
||||||
|
@override
|
||||||
|
final String operator;
|
||||||
|
@override
|
||||||
|
final String terminus;
|
||||||
|
final List<String>? _route;
|
||||||
|
@override
|
||||||
|
List<String>? get route {
|
||||||
|
final value = _route;
|
||||||
|
if (value == null) return null;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
final DateTime departureDate;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StationTrain(rank: $rank, number: $number, operator: $operator, terminus: $terminus, route: $route, departureDate: $departureDate)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(dynamic other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$_StationTrain &&
|
||||||
|
(identical(other.rank, rank) || other.rank == rank) &&
|
||||||
|
(identical(other.number, number) || other.number == number) &&
|
||||||
|
(identical(other.operator, operator) ||
|
||||||
|
other.operator == operator) &&
|
||||||
|
(identical(other.terminus, terminus) ||
|
||||||
|
other.terminus == terminus) &&
|
||||||
|
const DeepCollectionEquality().equals(other._route, _route) &&
|
||||||
|
(identical(other.departureDate, departureDate) ||
|
||||||
|
other.departureDate == departureDate));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, rank, number, operator, terminus,
|
||||||
|
const DeepCollectionEquality().hash(_route), departureDate);
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$_StationTrainCopyWith<_$_StationTrain> get copyWith =>
|
||||||
|
__$$_StationTrainCopyWithImpl<_$_StationTrain>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$_StationTrainToJson(
|
||||||
|
this,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _StationTrain implements StationTrain {
|
||||||
|
const factory _StationTrain(
|
||||||
|
{required final String rank,
|
||||||
|
required final String number,
|
||||||
|
required final String operator,
|
||||||
|
required final String terminus,
|
||||||
|
final List<String>? route,
|
||||||
|
required final DateTime departureDate}) = _$_StationTrain;
|
||||||
|
|
||||||
|
factory _StationTrain.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$_StationTrain.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get rank;
|
||||||
|
@override
|
||||||
|
String get number;
|
||||||
|
@override
|
||||||
|
String get operator;
|
||||||
|
@override
|
||||||
|
String get terminus;
|
||||||
|
@override
|
||||||
|
List<String>? get route;
|
||||||
|
@override
|
||||||
|
DateTime get departureDate;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$_StationTrainCopyWith<_$_StationTrain> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
28
lib/models/station_train.g.dart
Normal file
28
lib/models/station_train.g.dart
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'station_train.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_$_StationTrain _$$_StationTrainFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$_StationTrain(
|
||||||
|
rank: json['rank'] as String,
|
||||||
|
number: json['number'] as String,
|
||||||
|
operator: json['operator'] as String,
|
||||||
|
terminus: json['terminus'] as String,
|
||||||
|
route:
|
||||||
|
(json['route'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
||||||
|
departureDate: DateTime.parse(json['departureDate'] as String),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$_StationTrainToJson(_$_StationTrain instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'rank': instance.rank,
|
||||||
|
'number': instance.number,
|
||||||
|
'operator': instance.operator,
|
||||||
|
'terminus': instance.terminus,
|
||||||
|
'route': instance.route,
|
||||||
|
'departureDate': instance.departureDate.toIso8601String(),
|
||||||
|
};
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
part 'stations_result.g.dart';
|
part 'stations_result.g.dart';
|
||||||
|
part 'stations_result.freezed.dart';
|
||||||
|
|
||||||
@JsonSerializable()
|
@freezed
|
||||||
class StationsResult {
|
class StationsResult with _$StationsResult {
|
||||||
final String name;
|
const factory StationsResult({
|
||||||
final List<String>? stoppedAtBy;
|
required String name,
|
||||||
|
List<String>? stoppedAtBy,
|
||||||
const StationsResult({required this.name, this.stoppedAtBy});
|
}) = _StationsResult;
|
||||||
|
|
||||||
factory StationsResult.fromJson(Map<String, dynamic> json) => _$StationsResultFromJson(json);
|
factory StationsResult.fromJson(Map<String, dynamic> json) => _$StationsResultFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$StationsResultToJson(this);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
178
lib/models/stations_result.freezed.dart
Normal file
178
lib/models/stations_result.freezed.dart
Normal file
|
|
@ -0,0 +1,178 @@
|
||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
|
||||||
|
|
||||||
|
part of 'stations_result.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
|
||||||
|
|
||||||
|
StationsResult _$StationsResultFromJson(Map<String, dynamic> json) {
|
||||||
|
return _StationsResult.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$StationsResult {
|
||||||
|
String get name => throw _privateConstructorUsedError;
|
||||||
|
List<String>? get stoppedAtBy => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$StationsResultCopyWith<StationsResult> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $StationsResultCopyWith<$Res> {
|
||||||
|
factory $StationsResultCopyWith(
|
||||||
|
StationsResult value, $Res Function(StationsResult) then) =
|
||||||
|
_$StationsResultCopyWithImpl<$Res, StationsResult>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String name, List<String>? stoppedAtBy});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$StationsResultCopyWithImpl<$Res, $Val extends StationsResult>
|
||||||
|
implements $StationsResultCopyWith<$Res> {
|
||||||
|
_$StationsResultCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? name = null,
|
||||||
|
Object? stoppedAtBy = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
name: null == name
|
||||||
|
? _value.name
|
||||||
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
stoppedAtBy: freezed == stoppedAtBy
|
||||||
|
? _value.stoppedAtBy
|
||||||
|
: stoppedAtBy // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$_StationsResultCopyWith<$Res>
|
||||||
|
implements $StationsResultCopyWith<$Res> {
|
||||||
|
factory _$$_StationsResultCopyWith(
|
||||||
|
_$_StationsResult value, $Res Function(_$_StationsResult) then) =
|
||||||
|
__$$_StationsResultCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({String name, List<String>? stoppedAtBy});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$_StationsResultCopyWithImpl<$Res>
|
||||||
|
extends _$StationsResultCopyWithImpl<$Res, _$_StationsResult>
|
||||||
|
implements _$$_StationsResultCopyWith<$Res> {
|
||||||
|
__$$_StationsResultCopyWithImpl(
|
||||||
|
_$_StationsResult _value, $Res Function(_$_StationsResult) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? name = null,
|
||||||
|
Object? stoppedAtBy = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(_$_StationsResult(
|
||||||
|
name: null == name
|
||||||
|
? _value.name
|
||||||
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
stoppedAtBy: freezed == stoppedAtBy
|
||||||
|
? _value._stoppedAtBy
|
||||||
|
: stoppedAtBy // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$_StationsResult implements _StationsResult {
|
||||||
|
const _$_StationsResult({required this.name, final List<String>? stoppedAtBy})
|
||||||
|
: _stoppedAtBy = stoppedAtBy;
|
||||||
|
|
||||||
|
factory _$_StationsResult.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$_StationsResultFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String name;
|
||||||
|
final List<String>? _stoppedAtBy;
|
||||||
|
@override
|
||||||
|
List<String>? get stoppedAtBy {
|
||||||
|
final value = _stoppedAtBy;
|
||||||
|
if (value == null) return null;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StationsResult(name: $name, stoppedAtBy: $stoppedAtBy)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(dynamic other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$_StationsResult &&
|
||||||
|
(identical(other.name, name) || other.name == name) &&
|
||||||
|
const DeepCollectionEquality()
|
||||||
|
.equals(other._stoppedAtBy, _stoppedAtBy));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType, name, const DeepCollectionEquality().hash(_stoppedAtBy));
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$_StationsResultCopyWith<_$_StationsResult> get copyWith =>
|
||||||
|
__$$_StationsResultCopyWithImpl<_$_StationsResult>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$_StationsResultToJson(
|
||||||
|
this,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _StationsResult implements StationsResult {
|
||||||
|
const factory _StationsResult(
|
||||||
|
{required final String name,
|
||||||
|
final List<String>? stoppedAtBy}) = _$_StationsResult;
|
||||||
|
|
||||||
|
factory _StationsResult.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$_StationsResult.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get name;
|
||||||
|
@override
|
||||||
|
List<String>? get stoppedAtBy;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$_StationsResultCopyWith<_$_StationsResult> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
@ -6,15 +6,15 @@ part of 'stations_result.dart';
|
||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
StationsResult _$StationsResultFromJson(Map<String, dynamic> json) =>
|
_$_StationsResult _$$_StationsResultFromJson(Map<String, dynamic> json) =>
|
||||||
StationsResult(
|
_$_StationsResult(
|
||||||
name: json['name'] as String,
|
name: json['name'] as String,
|
||||||
stoppedAtBy: (json['stoppedAtBy'] as List<dynamic>?)
|
stoppedAtBy: (json['stoppedAtBy'] as List<dynamic>?)
|
||||||
?.map((e) => e as String)
|
?.map((e) => e as String)
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$StationsResultToJson(StationsResult instance) =>
|
Map<String, dynamic> _$$_StationsResultToJson(_$_StationsResult instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'name': instance.name,
|
'name': instance.name,
|
||||||
'stoppedAtBy': instance.stoppedAtBy,
|
'stoppedAtBy': instance.stoppedAtBy,
|
||||||
|
|
|
||||||
|
|
@ -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!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,15 @@
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
part 'trains_result.g.dart';
|
part 'trains_result.g.dart';
|
||||||
|
part 'trains_result.freezed.dart';
|
||||||
|
|
||||||
@JsonSerializable()
|
@freezed
|
||||||
class TrainsResult {
|
class TrainsResult with _$TrainsResult {
|
||||||
final String rank;
|
const factory TrainsResult({
|
||||||
final String number;
|
required String rank,
|
||||||
final String company;
|
required String number,
|
||||||
|
required String company,
|
||||||
const TrainsResult({
|
}) = _TrainsResult;
|
||||||
required this.rank,
|
|
||||||
required this.number,
|
|
||||||
required this.company,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory TrainsResult.fromJson(Map<String, dynamic> json) => _$TrainsResultFromJson(json);
|
factory TrainsResult.fromJson(Map<String, dynamic> json) => _$TrainsResultFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$TrainsResultToJson(this);
|
|
||||||
}
|
}
|
||||||
187
lib/models/trains_result.freezed.dart
Normal file
187
lib/models/trains_result.freezed.dart
Normal file
|
|
@ -0,0 +1,187 @@
|
||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
|
||||||
|
|
||||||
|
part of 'trains_result.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
|
||||||
|
|
||||||
|
TrainsResult _$TrainsResultFromJson(Map<String, dynamic> json) {
|
||||||
|
return _TrainsResult.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$TrainsResult {
|
||||||
|
String get rank => throw _privateConstructorUsedError;
|
||||||
|
String get number => throw _privateConstructorUsedError;
|
||||||
|
String get company => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$TrainsResultCopyWith<TrainsResult> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $TrainsResultCopyWith<$Res> {
|
||||||
|
factory $TrainsResultCopyWith(
|
||||||
|
TrainsResult value, $Res Function(TrainsResult) then) =
|
||||||
|
_$TrainsResultCopyWithImpl<$Res, TrainsResult>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String rank, String number, String company});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$TrainsResultCopyWithImpl<$Res, $Val extends TrainsResult>
|
||||||
|
implements $TrainsResultCopyWith<$Res> {
|
||||||
|
_$TrainsResultCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? rank = null,
|
||||||
|
Object? number = null,
|
||||||
|
Object? company = null,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
rank: null == rank
|
||||||
|
? _value.rank
|
||||||
|
: rank // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
number: null == number
|
||||||
|
? _value.number
|
||||||
|
: number // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
company: null == company
|
||||||
|
? _value.company
|
||||||
|
: company // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$_TrainsResultCopyWith<$Res>
|
||||||
|
implements $TrainsResultCopyWith<$Res> {
|
||||||
|
factory _$$_TrainsResultCopyWith(
|
||||||
|
_$_TrainsResult value, $Res Function(_$_TrainsResult) then) =
|
||||||
|
__$$_TrainsResultCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({String rank, String number, String company});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$_TrainsResultCopyWithImpl<$Res>
|
||||||
|
extends _$TrainsResultCopyWithImpl<$Res, _$_TrainsResult>
|
||||||
|
implements _$$_TrainsResultCopyWith<$Res> {
|
||||||
|
__$$_TrainsResultCopyWithImpl(
|
||||||
|
_$_TrainsResult _value, $Res Function(_$_TrainsResult) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? rank = null,
|
||||||
|
Object? number = null,
|
||||||
|
Object? company = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$_TrainsResult(
|
||||||
|
rank: null == rank
|
||||||
|
? _value.rank
|
||||||
|
: rank // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
number: null == number
|
||||||
|
? _value.number
|
||||||
|
: number // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
company: null == company
|
||||||
|
? _value.company
|
||||||
|
: company // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$_TrainsResult implements _TrainsResult {
|
||||||
|
const _$_TrainsResult(
|
||||||
|
{required this.rank, required this.number, required this.company});
|
||||||
|
|
||||||
|
factory _$_TrainsResult.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$_TrainsResultFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String rank;
|
||||||
|
@override
|
||||||
|
final String number;
|
||||||
|
@override
|
||||||
|
final String company;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'TrainsResult(rank: $rank, number: $number, company: $company)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(dynamic other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$_TrainsResult &&
|
||||||
|
(identical(other.rank, rank) || other.rank == rank) &&
|
||||||
|
(identical(other.number, number) || other.number == number) &&
|
||||||
|
(identical(other.company, company) || other.company == company));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, rank, number, company);
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$_TrainsResultCopyWith<_$_TrainsResult> get copyWith =>
|
||||||
|
__$$_TrainsResultCopyWithImpl<_$_TrainsResult>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$_TrainsResultToJson(
|
||||||
|
this,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _TrainsResult implements TrainsResult {
|
||||||
|
const factory _TrainsResult(
|
||||||
|
{required final String rank,
|
||||||
|
required final String number,
|
||||||
|
required final String company}) = _$_TrainsResult;
|
||||||
|
|
||||||
|
factory _TrainsResult.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$_TrainsResult.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get rank;
|
||||||
|
@override
|
||||||
|
String get number;
|
||||||
|
@override
|
||||||
|
String get company;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$_TrainsResultCopyWith<_$_TrainsResult> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
@ -6,13 +6,14 @@ part of 'trains_result.dart';
|
||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
TrainsResult _$TrainsResultFromJson(Map<String, dynamic> json) => TrainsResult(
|
_$_TrainsResult _$$_TrainsResultFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$_TrainsResult(
|
||||||
rank: json['rank'] as String,
|
rank: json['rank'] as String,
|
||||||
number: json['number'] as String,
|
number: json['number'] as String,
|
||||||
company: json['company'] as String,
|
company: json['company'] as String,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$TrainsResultToJson(TrainsResult instance) =>
|
Map<String, dynamic> _$$_TrainsResultToJson(_$_TrainsResult instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'rank': instance.rank,
|
'rank': instance.rank,
|
||||||
'number': instance.number,
|
'number': instance.number,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:info_tren/api/releases.dart';
|
import 'package:info_tren/api/releases.dart';
|
||||||
import 'package:info_tren/models/changelog_entry.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/models/ui_design.dart';
|
|
||||||
import 'package:info_tren/pages/about/about_page_cupertino.dart';
|
import 'package:info_tren/pages/about/about_page_cupertino.dart';
|
||||||
import 'package:info_tren/pages/about/about_page_material.dart';
|
import 'package:info_tren/pages/about/about_page_material.dart';
|
||||||
import 'package:info_tren/utils/default_ui_design.dart';
|
import 'package:info_tren/utils/default_ui_design.dart';
|
||||||
|
|
@ -30,7 +29,7 @@ class AboutPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AboutPageState extends State<AboutPage> {
|
abstract class AboutPageState extends State<AboutPage> {
|
||||||
static const String DOWNLOAD = String.fromEnvironment('DOWNLOAD');
|
static const String download = String.fromEnvironment('DOWNLOAD');
|
||||||
|
|
||||||
final String pageTitle = 'Despre aplicație';
|
final String pageTitle = 'Despre aplicație';
|
||||||
final String versionTitleText = 'Versiunea aplicației';
|
final String versionTitleText = 'Versiunea aplicației';
|
||||||
|
|
|
||||||
|
|
@ -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,16 +88,16 @@ 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,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
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,24 +78,24 @@ 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,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (AboutPageState.DOWNLOAD == 'apk' && log.apkLink != null)
|
if (AboutPageState.download == 'apk' && log.apkLink != null)
|
||||||
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),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:info_tren/models/ui_design.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';
|
||||||
import 'package:info_tren/pages/main/main_page_cupertino.dart';
|
import 'package:info_tren/pages/main/main_page_cupertino.dart';
|
||||||
import 'package:info_tren/pages/main/main_page_material.dart';
|
import 'package:info_tren/pages/main/main_page_material.dart';
|
||||||
|
|
@ -18,9 +18,9 @@ class MainPage extends StatelessWidget {
|
||||||
|
|
||||||
switch (uiDesign) {
|
switch (uiDesign) {
|
||||||
case UiDesign.MATERIAL:
|
case UiDesign.MATERIAL:
|
||||||
return MainPageMaterial();
|
return const MainPageMaterial();
|
||||||
case UiDesign.CUPERTINO:
|
case UiDesign.CUPERTINO:
|
||||||
return MainPageCupertino();
|
return const MainPageCupertino();
|
||||||
default:
|
default:
|
||||||
throw UnmatchedUiDesignException(uiDesign);
|
throw UnmatchedUiDesignException(uiDesign);
|
||||||
}
|
}
|
||||||
|
|
@ -31,6 +31,8 @@ abstract class MainPageShared extends StatelessWidget {
|
||||||
final String pageTitle = 'Info Tren';
|
final String pageTitle = 'Info Tren';
|
||||||
final String moreOptionsText = 'Mai multe opțiuni';
|
final String moreOptionsText = 'Mai multe opțiuni';
|
||||||
|
|
||||||
|
const MainPageShared({super.key});
|
||||||
|
|
||||||
List<MainPageAction> get popupMenu => [
|
List<MainPageAction> get popupMenu => [
|
||||||
MainPageAction(
|
MainPageAction(
|
||||||
name: 'Despre aplicație',
|
name: 'Despre aplicație',
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,14 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:info_tren/pages/main/main_page.dart';
|
import 'package:info_tren/pages/main/main_page.dart';
|
||||||
|
|
||||||
class MainPageCupertino extends MainPageShared {
|
class MainPageCupertino extends MainPageShared {
|
||||||
|
const MainPageCupertino({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
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 +27,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 +41,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 +60,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(
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:info_tren/pages/main/main_page.dart';
|
import 'package:info_tren/pages/main/main_page.dart';
|
||||||
|
|
||||||
class MainPageMaterial extends MainPageShared {
|
class MainPageMaterial extends MainPageShared {
|
||||||
|
const MainPageMaterial({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|
@ -10,11 +12,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 +38,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,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:info_tren/models/ui_design.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/pages/station_arrdep_page/select_station/select_station_cupertino.dart';
|
import 'package:info_tren/pages/station_arrdep_page/select_station/select_station_cupertino.dart';
|
||||||
import 'package:info_tren/pages/station_arrdep_page/select_station/select_station_material.dart';
|
import 'package:info_tren/pages/station_arrdep_page/select_station/select_station_material.dart';
|
||||||
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station.dart';
|
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station.dart';
|
||||||
import 'package:info_tren/utils/default_ui_design.dart';
|
import 'package:info_tren/utils/default_ui_design.dart';
|
||||||
import 'package:info_tren/api/stations.dart' as apiStations;
|
import 'package:info_tren/api/stations.dart' as api_stations;
|
||||||
|
|
||||||
class SelectStationPage extends StatefulWidget {
|
class SelectStationPage extends StatefulWidget {
|
||||||
final UiDesign? uiDesign;
|
final UiDesign? uiDesign;
|
||||||
|
|
@ -63,7 +63,7 @@ abstract class SelectStationPageState extends State<SelectStationPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
apiStations.stations.then((value) {
|
api_stations.stations.then((value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
stations = value.map((e) => e.name).toList(growable: false,);
|
stations = value.map((e) => e.name).toList(growable: false,);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:info_tren/api/station_data.dart';
|
import 'package:info_tren/api/station_data.dart';
|
||||||
import 'package:info_tren/components/refresh_future_builder.dart';
|
import 'package:info_tren/components/refresh_future_builder.dart';
|
||||||
import 'package:info_tren/models/station_data.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/models/ui_design.dart';
|
|
||||||
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station_cupertino.dart';
|
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station_cupertino.dart';
|
||||||
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station_material.dart';
|
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station_material.dart';
|
||||||
import 'package:info_tren/pages/train_info_page/view_train/train_info.dart';
|
import 'package:info_tren/pages/train_info_page/view_train/train_info.dart';
|
||||||
|
|
|
||||||
|
|
@ -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';
|
||||||
import 'package:info_tren/components/refresh_future_builder.dart';
|
import 'package:info_tren/components/refresh_future_builder.dart';
|
||||||
import 'package:info_tren/components/sliver_persistent_header_padding.dart';
|
import 'package:info_tren/components/sliver_persistent_header_padding.dart';
|
||||||
import 'package:info_tren/models/station_data.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station.dart';
|
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station.dart';
|
||||||
|
|
||||||
class ViewStationPageStateCupertino extends ViewStationPageState {
|
class ViewStationPageStateCupertino extends ViewStationPageState {
|
||||||
|
|
@ -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')}'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:info_tren/components/badge.dart';
|
import 'package:info_tren/components/badge.dart';
|
||||||
import 'package:info_tren/components/loading/loading.dart';
|
import 'package:info_tren/components/loading/loading.dart';
|
||||||
import 'package:info_tren/components/refresh_future_builder.dart';
|
import 'package:info_tren/components/refresh_future_builder.dart';
|
||||||
import 'package:info_tren/models/station_data.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station.dart';
|
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station.dart';
|
||||||
|
|
||||||
class ViewStationPageStateMaterial extends ViewStationPageState {
|
class ViewStationPageStateMaterial extends ViewStationPageState {
|
||||||
|
|
@ -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,23 +1,20 @@
|
||||||
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';
|
||||||
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions.dart';
|
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions.dart';
|
||||||
import 'package:info_tren/models/trains_result.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/models/ui_design.dart';
|
|
||||||
import 'package:info_tren/pages/train_info_page/select_train/select_train_cupertino.dart';
|
import 'package:info_tren/pages/train_info_page/select_train/select_train_cupertino.dart';
|
||||||
import 'package:info_tren/pages/train_info_page/select_train/select_train_material.dart';
|
import 'package:info_tren/pages/train_info_page/select_train/select_train_material.dart';
|
||||||
import 'package:info_tren/pages/train_info_page/view_train/train_info.dart';
|
import 'package:info_tren/pages/train_info_page/view_train/train_info.dart';
|
||||||
import 'package:info_tren/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 api_trains;
|
||||||
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";
|
||||||
|
|
||||||
|
|
@ -77,7 +74,7 @@ abstract class SelectTrainPageState extends State<SelectTrainPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
apiTrains.trains.then((value) {
|
api_trains.trains.then((value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
trains = value;
|
trains = value;
|
||||||
trains.sort((t1, t2) {
|
trains.sort((t1, t2) {
|
||||||
|
|
|
||||||
|
|
@ -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: [
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
const BACKGROUND_GREEN = Color.fromRGBO(5, 66, 10, 1);
|
const backgroundGreen = Color.fromRGBO(5, 66, 10, 1);
|
||||||
const FOREGROUND_GREEN = Color.fromRGBO(20, 180, 50, 1);
|
const foregroundGreen = Color.fromRGBO(20, 180, 50, 1);
|
||||||
|
|
||||||
const BACKGROUND_RED = Color.fromRGBO(66, 10, 5, 1);
|
const backgroundRed = Color.fromRGBO(66, 10, 5, 1);
|
||||||
|
|
||||||
const FOREGROUND_WHITE = Color.fromRGBO(240, 250, 240, 1);
|
const foregroundWhite = Color.fromRGBO(240, 250, 240, 1);
|
||||||
|
|
||||||
const FOREGROUND_DARK_GREY = Color.fromRGBO(55, 55, 55, 1);
|
const foregroundDarkGrey = Color.fromRGBO(55, 55, 55, 1);
|
||||||
|
|
@ -4,8 +4,7 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:info_tren/api/train_data.dart';
|
import 'package:info_tren/api/train_data.dart';
|
||||||
import 'package:info_tren/components/loading/loading.dart';
|
import 'package:info_tren/components/loading/loading.dart';
|
||||||
import 'package:info_tren/components/refresh_future_builder.dart';
|
import 'package:info_tren/components/refresh_future_builder.dart';
|
||||||
import 'package:info_tren/models/train_data.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/models/ui_design.dart';
|
|
||||||
import 'package:info_tren/pages/train_info_page/view_train/train_info_cupertino.dart';
|
import 'package:info_tren/pages/train_info_page/view_train/train_info_cupertino.dart';
|
||||||
import 'package:info_tren/pages/train_info_page/view_train/train_info_material.dart';
|
import 'package:info_tren/pages/train_info_page/view_train/train_info_material.dart';
|
||||||
import 'package:info_tren/utils/default_ui_design.dart';
|
import 'package:info_tren/utils/default_ui_design.dart';
|
||||||
|
|
@ -18,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) {
|
||||||
|
|
@ -78,7 +77,12 @@ abstract class TrainInfoLoading extends StatelessWidget {
|
||||||
final String title;
|
final String title;
|
||||||
final Widget loadingWidget;
|
final Widget loadingWidget;
|
||||||
|
|
||||||
TrainInfoLoading({required this.title, String? loadingText, UiDesign? uiDesign}) : loadingWidget = Loading(uiDesign: uiDesign, text: loadingText,);
|
TrainInfoLoading({
|
||||||
|
required this.title,
|
||||||
|
String? loadingText,
|
||||||
|
UiDesign? uiDesign,
|
||||||
|
super.key,
|
||||||
|
}) : loadingWidget = Loading(uiDesign: uiDesign, text: loadingText,);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class TrainInfoError extends StatelessWidget {
|
abstract class TrainInfoError extends StatelessWidget {
|
||||||
|
|
@ -86,7 +90,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, super.key,});
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class DisplayTrainYesterdayWarningCommon extends StatelessWidget {
|
abstract class DisplayTrainYesterdayWarningCommon extends StatelessWidget {
|
||||||
|
|
@ -95,5 +99,5 @@ abstract class DisplayTrainYesterdayWarningCommon extends StatelessWidget {
|
||||||
|
|
||||||
final void Function() onViewYesterdayTrain;
|
final void Function() onViewYesterdayTrain;
|
||||||
|
|
||||||
DisplayTrainYesterdayWarningCommon(this.onViewYesterdayTrain);
|
const DisplayTrainYesterdayWarningCommon(this.onViewYesterdayTrain, {super.key,});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,19 +4,15 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:info_tren/components/cupertino_divider.dart';
|
import 'package:info_tren/components/cupertino_divider.dart';
|
||||||
import 'package:info_tren/components/sliver_persistent_header_padding.dart';
|
import 'package:info_tren/components/sliver_persistent_header_padding.dart';
|
||||||
import 'package:info_tren/models/train_data.dart' hide State;
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/models/ui_design.dart';
|
|
||||||
import 'package:info_tren/pages/train_info_page/train_info_constants.dart';
|
import 'package:info_tren/pages/train_info_page/train_info_constants.dart';
|
||||||
import 'package:info_tren/pages/train_info_page/view_train/train_info.dart';
|
import 'package:info_tren/pages/train_info_page/view_train/train_info.dart';
|
||||||
import 'package:info_tren/pages/train_info_page/view_train/train_info_cupertino_DisplayTrainStation.dart';
|
import 'package:info_tren/pages/train_info_page/view_train/train_info_cupertino_DisplayTrainStation.dart';
|
||||||
import 'package:info_tren/utils/state_to_string.dart';
|
import 'package:info_tren/utils/state_to_string.dart';
|
||||||
|
|
||||||
class TrainInfoLoadingCupertino extends TrainInfoLoading {
|
class TrainInfoLoadingCupertino extends TrainInfoLoading {
|
||||||
TrainInfoLoadingCupertino({required String title, String? loadingText})
|
TrainInfoLoadingCupertino({required super.title, super.loadingText, super.key,})
|
||||||
: super(
|
: super(uiDesign: UiDesign.CUPERTINO);
|
||||||
title: title,
|
|
||||||
loadingText: loadingText,
|
|
||||||
uiDesign: UiDesign.CUPERTINO);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -32,10 +28,11 @@ 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,
|
||||||
|
super.key,
|
||||||
}) : super(
|
}) : super(
|
||||||
error: error,
|
error: error,
|
||||||
title: title,
|
title: title,
|
||||||
|
|
@ -57,7 +54,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!(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -74,11 +71,12 @@ 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,
|
||||||
this.onViewYesterdayTrain,
|
this.onViewYesterdayTrain,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -86,10 +84,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!(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -122,11 +120,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(
|
||||||
|
|
@ -137,12 +135,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,
|
||||||
),
|
),
|
||||||
|
|
@ -153,7 +151,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,
|
||||||
),
|
),
|
||||||
|
|
@ -163,7 +161,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'),
|
||||||
],
|
],
|
||||||
|
|
@ -196,15 +194,15 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
DisplayTrainDeparture(
|
DisplayTrainDeparture(
|
||||||
trainData: trainData,
|
trainData: trainData,
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
const SliverToBoxAdapter(
|
||||||
child: CupertinoDivider(
|
child: CupertinoDivider(
|
||||||
color: FOREGROUND_WHITE,
|
color: foregroundWhite,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DisplayTrainLastInfo(
|
DisplayTrainLastInfo(
|
||||||
trainData: trainData,
|
trainData: trainData,
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
const SliverToBoxAdapter(
|
||||||
child: CupertinoDivider(),
|
child: CupertinoDivider(),
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
|
|
@ -222,7 +220,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(),
|
||||||
),
|
),
|
||||||
|
|
@ -257,18 +255,18 @@ class TrainInfoCupertino extends StatelessWidget {
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
SliverToBoxAdapter(
|
const SliverToBoxAdapter(
|
||||||
child: CupertinoDivider(
|
child: CupertinoDivider(
|
||||||
color: FOREGROUND_WHITE,
|
color: foregroundWhite,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (onViewYesterdayTrain != null && trainData.stations.first.departure!.scheduleTime.compareTo(DateTime.now()) > 0) ...[
|
if (onViewYesterdayTrain != null && trainData.stations.first.departure!.scheduleTime.compareTo(DateTime.now()) > 0) ...[
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: DisplayTrainYesterdayWarningCupertino(onViewYesterdayTrain!),
|
child: DisplayTrainYesterdayWarningCupertino(onViewYesterdayTrain!),
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
const SliverToBoxAdapter(
|
||||||
child: CupertinoDivider(
|
child: CupertinoDivider(
|
||||||
color: FOREGROUND_WHITE,
|
color: foregroundWhite,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -395,7 +393,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -409,10 +407,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,),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -427,7 +425,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -448,7 +446,7 @@ class DisplayTrainRoute extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Center(child: Text("-")),
|
const Center(child: Text("-")),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|
@ -473,7 +471,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -494,7 +492,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -518,7 +516,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -692,7 +690,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -710,7 +708,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(
|
||||||
|
|
@ -750,20 +748,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
|
||||||
|
|
@ -792,7 +790,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -822,7 +820,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -849,10 +847,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -861,10 +860,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -873,10 +873,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -895,7 +896,7 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DisplayTrainYesterdayWarningCupertino extends DisplayTrainYesterdayWarningCommon {
|
class DisplayTrainYesterdayWarningCupertino extends DisplayTrainYesterdayWarningCommon {
|
||||||
DisplayTrainYesterdayWarningCupertino(void Function() onViewYesterdayTrain) : super(onViewYesterdayTrain);
|
const DisplayTrainYesterdayWarningCupertino(super.onViewYesterdayTrain, {super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -907,11 +908,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()
|
||||||
|
|
@ -930,8 +931,9 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -940,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,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:info_tren/models/train_data.dart';
|
|
||||||
import 'package:info_tren/components/badge.dart';
|
import 'package:info_tren/components/badge.dart';
|
||||||
|
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, super.key,});
|
||||||
|
|
||||||
@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,8 +84,9 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -105,8 +106,9 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -158,9 +160,10 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -176,7 +179,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,8 +243,9 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -250,7 +254,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 +274,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,9 +295,10 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -303,7 +308,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,8 +378,9 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -387,8 +393,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(
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,15 @@
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:info_tren/components/slim_app_bar.dart';
|
import 'package:info_tren/components/slim_app_bar.dart';
|
||||||
import 'package:info_tren/models/train_data.dart' hide State;
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/models/ui_design.dart';
|
|
||||||
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station.dart';
|
import 'package:info_tren/pages/station_arrdep_page/view_station/view_station.dart';
|
||||||
import 'package:info_tren/pages/train_info_page/view_train/train_info.dart';
|
import 'package:info_tren/pages/train_info_page/view_train/train_info.dart';
|
||||||
import 'package:info_tren/pages/train_info_page/view_train/train_info_material_DisplayTrainStation.dart';
|
import 'package:info_tren/pages/train_info_page/view_train/train_info_material_DisplayTrainStation.dart';
|
||||||
import 'package:info_tren/utils/state_to_string.dart';
|
import 'package:info_tren/utils/state_to_string.dart';
|
||||||
|
|
||||||
class TrainInfoLoadingMaterial extends TrainInfoLoading {
|
class TrainInfoLoadingMaterial extends TrainInfoLoading {
|
||||||
TrainInfoLoadingMaterial({required String title, String? loadingText})
|
TrainInfoLoadingMaterial({required super.title, super.loadingText, super.key,})
|
||||||
: super(
|
: super(uiDesign: UiDesign.MATERIAL);
|
||||||
title: title,
|
|
||||||
loadingText: loadingText,
|
|
||||||
uiDesign: UiDesign.MATERIAL);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -30,15 +26,12 @@ class TrainInfoLoadingMaterial extends TrainInfoLoading {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TrainInfoErrorMaterial extends TrainInfoError {
|
class TrainInfoErrorMaterial extends TrainInfoError {
|
||||||
TrainInfoErrorMaterial({
|
const TrainInfoErrorMaterial({
|
||||||
required Object error,
|
required super.error,
|
||||||
required String title,
|
required super.title,
|
||||||
Future Function()? refresh,
|
super.refresh,
|
||||||
}) : super(
|
super.key,
|
||||||
error: error,
|
});
|
||||||
title: title,
|
|
||||||
refresh: refresh,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -55,7 +48,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!(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -74,10 +67,11 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -220,7 +214,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -231,21 +225,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,
|
||||||
|
|
@ -256,13 +250,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, super.key,});
|
||||||
|
|
||||||
@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,
|
||||||
),
|
),
|
||||||
|
|
@ -274,7 +268,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -286,21 +280,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,
|
||||||
|
|
@ -316,7 +310,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, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -325,7 +319,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,
|
||||||
|
|
@ -339,7 +333,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -358,7 +352,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,
|
||||||
),
|
),
|
||||||
|
|
@ -371,7 +365,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,
|
||||||
|
|
@ -384,7 +378,7 @@ class DisplayTrainLastInfo extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Text(
|
child: Text(
|
||||||
stateToString(trainData.status!.state),
|
stateToString(trainData.status!.state),
|
||||||
style: Theme.of(context).textTheme.bodyText2?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
fontSize: isSmallScreen(context) ? 16 : 18,
|
fontSize: isSmallScreen(context) ? 16 : 18,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
|
|
@ -419,7 +413,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,
|
||||||
),
|
),
|
||||||
|
|
@ -428,7 +422,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,
|
||||||
),
|
),
|
||||||
|
|
@ -531,7 +525,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -548,7 +542,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,
|
||||||
),
|
),
|
||||||
|
|
@ -559,7 +553,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,
|
||||||
),
|
),
|
||||||
|
|
@ -592,20 +586,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
|
||||||
|
|
@ -615,7 +609,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,
|
||||||
|
|
@ -635,7 +629,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -648,7 +642,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,
|
||||||
),
|
),
|
||||||
|
|
@ -656,7 +650,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,
|
||||||
|
|
@ -672,7 +666,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -685,7 +679,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,
|
||||||
),
|
),
|
||||||
|
|
@ -702,10 +696,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -714,10 +709,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -726,16 +722,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,
|
||||||
|
|
@ -752,8 +749,7 @@ class DisplayTrainRouteDuration extends StatelessWidget {
|
||||||
|
|
||||||
class DisplayTrainYesterdayWarningMaterial
|
class DisplayTrainYesterdayWarningMaterial
|
||||||
extends DisplayTrainYesterdayWarningCommon {
|
extends DisplayTrainYesterdayWarningCommon {
|
||||||
DisplayTrainYesterdayWarningMaterial(void Function() onViewYesterdayTrain)
|
const DisplayTrainYesterdayWarningMaterial(super.onViewYesterdayTrain, {super.key,});
|
||||||
: super(onViewYesterdayTrain);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -765,13 +761,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()
|
||||||
|
|
@ -789,7 +785,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, super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -797,6 +793,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: () {
|
||||||
|
|
@ -806,7 +803,6 @@ class DisplayTrainStations extends StatelessWidget {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
index: index,
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
childCount: trainData.stations.length,
|
childCount: trainData.stations.length,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:info_tren/models/train_data.dart';
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/components/badge.dart';
|
import 'package:info_tren/components/badge.dart';
|
||||||
import 'package:info_tren/pages/train_info_page/view_train/train_info_material.dart';
|
import 'package:info_tren/pages/train_info_page/view_train/train_info_material.dart';
|
||||||
|
|
||||||
|
|
@ -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, super.key,});
|
||||||
|
|
||||||
@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,15 +96,16 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
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,8 +118,9 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -144,7 +146,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 +159,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,9 +172,10 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -186,12 +189,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 +216,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 +238,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,8 +258,9 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -264,7 +268,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 +282,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,9 +309,10 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -320,12 +325,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 +353,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 +375,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,8 +396,9 @@ 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,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -405,11 +411,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 +426,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,
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:info_tren/models.dart';
|
||||||
import 'package:info_tren/stations_list.dart.old';
|
import 'package:info_tren/stations_list.dart.old';
|
||||||
|
|
||||||
import 'models/train_data.dart';
|
|
||||||
|
|
||||||
class TrainInfoDisplayData extends StatelessWidget {
|
class TrainInfoDisplayData extends StatelessWidget {
|
||||||
final TrainData trainData;
|
final TrainData trainData;
|
||||||
|
|
||||||
TrainInfoDisplayData(this.trainData);
|
const TrainInfoDisplayData(this.trainData, {super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -29,12 +28,12 @@ class TrainInfoDisplayData extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(4.0),
|
padding: const EdgeInsets.all(4.0),
|
||||||
child: TotalDetails(trainData),
|
child: TotalDetails(trainData),
|
||||||
),
|
),
|
||||||
CustomDivider(),
|
const CustomDivider(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(4.0),
|
padding: const EdgeInsets.all(4.0),
|
||||||
child: Destination(trainData),
|
child: Destination(trainData),
|
||||||
),
|
),
|
||||||
CustomDivider(),
|
const CustomDivider(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(4.0),
|
padding: const EdgeInsets.all(4.0),
|
||||||
child: LastUpdate(trainData),
|
child: LastUpdate(trainData),
|
||||||
|
|
@ -47,7 +46,7 @@ class TrainInfoDisplayData extends StatelessWidget {
|
||||||
// child: NextStop(trainData),
|
// child: NextStop(trainData),
|
||||||
// ),
|
// ),
|
||||||
// ],
|
// ],
|
||||||
CustomDivider(),
|
const CustomDivider(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(4.0),
|
padding: const EdgeInsets.all(4.0),
|
||||||
child: TrainStatus(trainData),
|
child: TrainStatus(trainData),
|
||||||
|
|
@ -58,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(),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -73,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, {super.key,});
|
||||||
|
|
||||||
@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, {super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -96,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,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -119,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, {super.key,});
|
||||||
|
|
||||||
@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,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -133,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, {super.key,});
|
||||||
|
|
||||||
@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, {super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -170,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, {super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -182,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>[
|
||||||
|
|
@ -200,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(
|
||||||
|
|
@ -248,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, {super.key,});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -256,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(
|
||||||
|
|
@ -273,13 +272,15 @@ class TotalDetails extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomDivider extends StatelessWidget {
|
class CustomDivider extends StatelessWidget {
|
||||||
|
const CustomDivider({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
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,),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:info_tren/models/ui_design.dart';
|
import 'package:info_tren/models.dart';
|
||||||
|
|
||||||
UiDesign get defaultUiDesign {
|
UiDesign get defaultUiDesign {
|
||||||
if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import 'package:info_tren/models/train_data.dart';
|
import 'package:info_tren/models.dart';
|
||||||
|
|
||||||
String stateToString(State state) {
|
String stateToString(TrainDataState state) {
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case State.PASSING:
|
case TrainDataState.PASSING:
|
||||||
return 'trecere fără oprire';
|
return 'trecere fără oprire';
|
||||||
case State.ARRIVAL:
|
case TrainDataState.ARRIVAL:
|
||||||
return 'sosire';
|
return 'sosire';
|
||||||
case State.DEPARTURE:
|
case TrainDataState.DEPARTURE:
|
||||||
return 'plecare';
|
return 'plecare';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
197
pubspec.lock
197
pubspec.lock
|
|
@ -7,14 +7,14 @@ packages:
|
||||||
name: _fe_analyzer_shared
|
name: _fe_analyzer_shared
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "31.0.0"
|
version: "50.0.0"
|
||||||
analyzer:
|
analyzer:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: analyzer
|
name: analyzer
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.8.0"
|
version: "5.2.0"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -28,21 +28,21 @@ packages:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.9.0"
|
version: "2.10.0"
|
||||||
build:
|
build:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build
|
name: build
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.0"
|
version: "2.3.1"
|
||||||
build_config:
|
build_config:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build_config
|
name: build_config
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "1.1.1"
|
||||||
build_daemon:
|
build_daemon:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -56,21 +56,21 @@ packages:
|
||||||
name: build_resolvers
|
name: build_resolvers
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.6"
|
version: "2.1.0"
|
||||||
build_runner:
|
build_runner:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: build_runner
|
name: build_runner
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.11"
|
version: "2.3.2"
|
||||||
build_runner_core:
|
build_runner_core:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build_runner_core
|
name: build_runner_core
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.2.2"
|
version: "7.2.7"
|
||||||
built_collection:
|
built_collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -84,14 +84,14 @@ packages:
|
||||||
name: built_value
|
name: built_value
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.4.0"
|
version: "8.4.2"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: characters
|
name: characters
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.1"
|
||||||
checked_yaml:
|
checked_yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -99,20 +99,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.0.1"
|
||||||
cli_util:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: cli_util
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "0.3.5"
|
|
||||||
code_builder:
|
code_builder:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: code_builder
|
name: code_builder
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.0"
|
version: "4.3.0"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -126,7 +119,7 @@ packages:
|
||||||
name: convert
|
name: convert
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.2"
|
version: "3.1.1"
|
||||||
crypto:
|
crypto:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -147,7 +140,7 @@ packages:
|
||||||
name: dart_style
|
name: dart_style
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "2.2.4"
|
||||||
ffi:
|
ffi:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -161,7 +154,7 @@ packages:
|
||||||
name: file
|
name: file
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.2"
|
version: "6.1.4"
|
||||||
fixnum:
|
fixnum:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -174,25 +167,53 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
flutter_redux:
|
flutter_hooks:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_redux
|
name: flutter_hooks
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.2"
|
version: "0.18.5+1"
|
||||||
|
flutter_lints:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: flutter_lints
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
|
flutter_riverpod:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_riverpod
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
flutter_web_plugins:
|
flutter_web_plugins:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
freezed:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: freezed
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.0"
|
||||||
|
freezed_annotation:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: freezed_annotation
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.0"
|
||||||
frontend_server_client:
|
frontend_server_client:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: frontend_server_client
|
name: frontend_server_client
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.3"
|
version: "3.1.0"
|
||||||
glob:
|
glob:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -206,14 +227,21 @@ packages:
|
||||||
name: graphs
|
name: graphs
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.2.0"
|
||||||
|
hooks_riverpod:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: hooks_riverpod
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
http:
|
http:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: http
|
name: http
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.13.4"
|
version: "0.13.5"
|
||||||
http_multi_server:
|
http_multi_server:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -227,7 +255,7 @@ packages:
|
||||||
name: http_parser
|
name: http_parser
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.1"
|
version: "4.0.2"
|
||||||
io:
|
io:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -243,47 +271,54 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.4"
|
version: "0.6.4"
|
||||||
json_annotation:
|
json_annotation:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: json_annotation
|
name: json_annotation
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.0"
|
version: "4.7.0"
|
||||||
json_serializable:
|
json_serializable:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: json_serializable
|
name: json_serializable
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.2"
|
version: "6.5.4"
|
||||||
|
lints:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: lints
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
logging:
|
logging:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: logging
|
name: logging
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
version: "1.1.0"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.12"
|
version: "0.12.13"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.4"
|
version: "0.2.0"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.0"
|
version: "1.8.0"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -304,42 +339,14 @@ packages:
|
||||||
name: package_info_plus
|
name: package_info_plus
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.3"
|
version: "3.0.1"
|
||||||
package_info_plus_linux:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: package_info_plus_linux
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.0.5"
|
|
||||||
package_info_plus_macos:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: package_info_plus_macos
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.3.0"
|
|
||||||
package_info_plus_platform_interface:
|
package_info_plus_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: package_info_plus_platform_interface
|
name: package_info_plus_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
version: "2.0.1"
|
||||||
package_info_plus_web:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: package_info_plus_web
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.0.5"
|
|
||||||
package_info_plus_windows:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: package_info_plus_windows
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.0"
|
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -353,7 +360,7 @@ packages:
|
||||||
name: plugin_platform_interface
|
name: plugin_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.2"
|
version: "2.1.3"
|
||||||
pool:
|
pool:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -367,14 +374,14 @@ packages:
|
||||||
name: pub_semver
|
name: pub_semver
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.2"
|
||||||
pubspec_parse:
|
pubspec_parse:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: pubspec_parse
|
name: pubspec_parse
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.2.1"
|
||||||
quiver:
|
quiver:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -382,27 +389,20 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "3.1.0"
|
||||||
redux:
|
riverpod:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: redux
|
name: riverpod
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.0"
|
version: "2.0.2"
|
||||||
rxdart:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: rxdart
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "0.22.6"
|
|
||||||
shelf:
|
shelf:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf
|
name: shelf
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.2"
|
version: "1.4.0"
|
||||||
shelf_web_socket:
|
shelf_web_socket:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -421,14 +421,14 @@ packages:
|
||||||
name: source_gen
|
name: source_gen
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.2"
|
version: "1.2.6"
|
||||||
source_helper:
|
source_helper:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_helper
|
name: source_helper
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.2"
|
version: "1.3.3"
|
||||||
source_span:
|
source_span:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -442,28 +442,35 @@ packages:
|
||||||
name: sprintf
|
name: sprintf
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.0"
|
version: "7.0.0"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stack_trace
|
name: stack_trace
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0"
|
version: "1.11.0"
|
||||||
|
state_notifier:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: state_notifier
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.7.2+1"
|
||||||
stream_channel:
|
stream_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stream_channel
|
name: stream_channel
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.1"
|
||||||
stream_transform:
|
stream_transform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stream_transform
|
name: stream_transform
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.1"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -491,7 +498,7 @@ packages:
|
||||||
name: tuple
|
name: tuple
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.1"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -505,14 +512,14 @@ packages:
|
||||||
name: url_launcher
|
name: url_launcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.5"
|
version: "6.1.6"
|
||||||
url_launcher_android:
|
url_launcher_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_android
|
name: url_launcher_android
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.17"
|
version: "6.0.21"
|
||||||
url_launcher_ios:
|
url_launcher_ios:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -540,14 +547,14 @@ packages:
|
||||||
name: url_launcher_platform_interface
|
name: url_launcher_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.1"
|
||||||
url_launcher_web:
|
url_launcher_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_web
|
name: url_launcher_web
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.12"
|
version: "2.0.13"
|
||||||
url_launcher_windows:
|
url_launcher_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -561,14 +568,14 @@ packages:
|
||||||
name: vector_math
|
name: vector_math
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.2"
|
version: "2.1.4"
|
||||||
watcher:
|
watcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: watcher
|
name: watcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
version: "1.0.2"
|
||||||
web_socket_channel:
|
web_socket_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -582,7 +589,7 @@ packages:
|
||||||
name: win32
|
name: win32
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.7.0"
|
version: "3.0.1"
|
||||||
yaml:
|
yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -591,5 +598,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.1"
|
version: "3.1.1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.17.0 <3.0.0"
|
dart: ">=2.18.0 <3.0.0"
|
||||||
flutter: ">=2.10.0"
|
flutter: ">=3.0.0"
|
||||||
|
|
|
||||||
17
pubspec.yaml
17
pubspec.yaml
|
|
@ -14,29 +14,32 @@ description: O aplicație de vizualizare a datelor puse la dispoziție de Inform
|
||||||
version: 2.7.8
|
version: 2.7.8
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.15.0 <3.0.0"
|
sdk: ">=2.17.0 <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.5
|
cupertino_icons: ^1.0.5
|
||||||
rxdart: ^0.22.0
|
|
||||||
http: ^0.13.0
|
http: ^0.13.0
|
||||||
tuple: ^2.0.0
|
tuple: ^2.0.0
|
||||||
sprintf: ^6.0.0
|
sprintf: ^7.0.0
|
||||||
flutter_redux: ^0.8.2
|
package_info_plus: ^3.0.1
|
||||||
package_info_plus: ^1.4.3
|
|
||||||
quiver: ^3.1.0
|
quiver: ^3.1.0
|
||||||
url_launcher: ^6.1.5
|
url_launcher: ^6.1.5
|
||||||
|
flutter_hooks: ^0.18.5+1
|
||||||
|
hooks_riverpod: ^2.0.2
|
||||||
|
freezed_annotation: ^2.2.0
|
||||||
|
json_annotation: ^4.7.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
# flutter_test:
|
# flutter_test:
|
||||||
# sdk: flutter
|
# sdk: flutter
|
||||||
build_runner: ^2.1.0
|
build_runner: ^2.1.0
|
||||||
json_serializable: ^5.0.0
|
json_serializable: ^6.5.4
|
||||||
|
freezed: 2.2.0
|
||||||
|
flutter_lints: ^2.0.1
|
||||||
|
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
// This is a basic Flutter widget test.
|
|
||||||
//
|
|
||||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
|
||||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
|
||||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
|
||||||
// tree, read text, and verify that the values of widget properties are correct.
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
|
|
||||||
import 'package:info_tren/main.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
|
||||||
// Build our app and trigger a frame.
|
|
||||||
await tester.pumpWidget(const MyApp());
|
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
|
||||||
expect(find.text('0'), findsOneWidget);
|
|
||||||
expect(find.text('1'), findsNothing);
|
|
||||||
|
|
||||||
// Tap the '+' icon and trigger a frame.
|
|
||||||
await tester.tap(find.byIcon(Icons.add));
|
|
||||||
await tester.pump();
|
|
||||||
|
|
||||||
// Verify that our counter has incremented.
|
|
||||||
expect(find.text('0'), findsNothing);
|
|
||||||
expect(find.text('1'), findsOneWidget);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue