-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added curve points and main signals to train journey (#82)
* feat: mapped signals, track equipments and curves from SFERA (#82) * chore: some fixes after merge * feat: implement additional speed restrictions * chore: add mock data for additional speed restrictions * chore: fix display * add missing icon * chore: fix height for base row * chore: fix ui tests * chore: refactor routestart and end * chore: revert flavor change * review changes * feat: visualize curves and signals in journey table (#82). * chore: fixed SFERA mapper test * chore: added UI tests and refactored mock data. * chore: fixed UI test * chore: fixed wrong merge conflict resolve * chore: inputs from code review --------- Co-authored-by: u221711 <[email protected]>
- Loading branch information
1 parent
0f8390e
commit 523ecca
Showing
20 changed files
with
345 additions
and
141 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
das_client/lib/app/pages/journey/train_journey/widgets/table/curve_point_row.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import 'package:das_client/app/i18n/i18n.dart'; | ||
import 'package:das_client/app/pages/journey/train_journey/widgets/table/base_row_builder.dart'; | ||
import 'package:das_client/app/widgets/assets.dart'; | ||
import 'package:das_client/app/widgets/table/das_table_cell.dart'; | ||
import 'package:das_client/model/journey/curve_point.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_svg/flutter_svg.dart'; | ||
|
||
class CurvePointRow extends BaseRowBuilder<CurvePoint> { | ||
static const Key curvePointIconKey = Key('curve_point_icon_key'); | ||
|
||
CurvePointRow({ | ||
required super.metadata, | ||
required super.data, | ||
}); | ||
|
||
@override | ||
DASTableCell informationCell(BuildContext context) { | ||
return DASTableCell( | ||
child: Text(data.curveType?.localizedName(context) ?? ''), | ||
); | ||
} | ||
|
||
@override | ||
DASTableCell iconsCell1(BuildContext context) { | ||
return DASTableCell( | ||
child: SvgPicture.asset( | ||
AppAssets.iconCurveStart, | ||
key: curvePointIconKey, | ||
), | ||
alignment: Alignment.center, | ||
); | ||
} | ||
} | ||
|
||
extension _CurveTypeExtension on CurveType { | ||
String localizedName(BuildContext context) { | ||
switch (this) { | ||
case CurveType.curve: | ||
return context.l10n.p_train_journey_table_curve_type_curve; | ||
case CurveType.curveAfterHalt: | ||
return context.l10n.p_train_journey_table_curve_type_curve_after_halt; | ||
case CurveType.stationExitCurve: | ||
return context.l10n.p_train_journey_table_curve_type_station_exit_curve; | ||
case CurveType.unknown: | ||
return context.l10n.c_unknown; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
das_client/lib/app/pages/journey/train_journey/widgets/table/signal_row.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import 'package:das_client/app/i18n/i18n.dart'; | ||
import 'package:das_client/app/pages/journey/train_journey/widgets/table/base_row_builder.dart'; | ||
import 'package:das_client/app/widgets/assets.dart'; | ||
import 'package:das_client/app/widgets/table/das_table_cell.dart'; | ||
import 'package:das_client/model/journey/signal.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_svg/flutter_svg.dart'; | ||
|
||
class SignalRow extends BaseRowBuilder<Signal> { | ||
static const Key signalLineChangeIconKey = Key('signal_line_change_icon_key'); | ||
|
||
SignalRow({ | ||
required super.metadata, | ||
required super.data, | ||
}); | ||
|
||
@override | ||
DASTableCell informationCell(BuildContext context) { | ||
return DASTableCell( | ||
child: Row( | ||
children: [ | ||
_signalFunctions(context), | ||
Spacer(), | ||
if (data.visualIdentifier != null) Text(data.visualIdentifier!), | ||
], | ||
), | ||
); | ||
} | ||
|
||
/// Signal functions displayed as string. Type [SignalFunction.laneChange] is ignored if other functions are given as this is displayed with an icon. | ||
Widget _signalFunctions(BuildContext context) { | ||
Iterable<SignalFunction> signalFunctions = data.functions; | ||
if (signalFunctions.length > 1) { | ||
signalFunctions = signalFunctions | ||
.where((function) => function != SignalFunction.laneChange && function != SignalFunction.unknown); | ||
} | ||
return Text(signalFunctions.map((function) => function.localizedName(context)).join('/')); | ||
} | ||
|
||
@override | ||
DASTableCell iconsCell1(BuildContext context) { | ||
if (data.functions.contains(SignalFunction.laneChange)) { | ||
return DASTableCell( | ||
child: SvgPicture.asset( | ||
key: signalLineChangeIconKey, | ||
AppAssets.iconSignalLaneChange, | ||
), | ||
alignment: Alignment.center, | ||
); | ||
} | ||
return DASTableCell.empty(); | ||
} | ||
} | ||
|
||
// extensions | ||
|
||
extension _SignalFunctionExtension on SignalFunction { | ||
String localizedName(BuildContext context) { | ||
switch (this) { | ||
case SignalFunction.entry: | ||
return context.l10n.c_main_signal_function_entry; | ||
case SignalFunction.block: | ||
return context.l10n.c_main_signal_function_block; | ||
case SignalFunction.exit: | ||
return context.l10n.c_main_signal_function_exit; | ||
case SignalFunction.laneChange: | ||
return context.l10n.c_main_signal_function_laneChange; | ||
case SignalFunction.intermediate: | ||
return context.l10n.c_main_signal_function_intermediate; | ||
case SignalFunction.protection: | ||
return context.l10n.c_main_signal_function_protection; | ||
case SignalFunction.unknown: | ||
return context.l10n.c_unknown; | ||
} | ||
} | ||
} |
Oops, something went wrong.