-
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: implement protection section (#407)
- Loading branch information
Showing
25 changed files
with
1,006 additions
and
39 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.
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
47 changes: 47 additions & 0 deletions
47
das_client/lib/app/pages/journey/train_journey/widgets/table/protection_section_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,47 @@ | ||
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/metadata.dart'; | ||
import 'package:das_client/model/journey/protection_section.dart'; | ||
import 'package:design_system_flutter/design_system_flutter.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_svg/flutter_svg.dart'; | ||
|
||
class ProtectionSectionRow extends BaseRowBuilder { | ||
static const Key protectionSectionKey = Key('protection_section_key'); | ||
|
||
ProtectionSectionRow({ | ||
super.height = 44.0, | ||
required this.metadata, | ||
required this.protectionSection, | ||
}) : super(rowColor: SBBColors.peach, kilometre: protectionSection.kilometre); | ||
|
||
final Metadata metadata; | ||
final ProtectionSection protectionSection; | ||
|
||
@override | ||
DASTableCell informationCell(BuildContext context) { | ||
return DASTableCell( | ||
child: Row( | ||
crossAxisAlignment: CrossAxisAlignment.end, | ||
children: [ | ||
Text( | ||
'${context.l10n.p_train_journey_table_kilometre_label} ${protectionSection.kilometre[0].toStringAsFixed(1)}'), | ||
Spacer(), | ||
Text('${protectionSection.isOptional ? 'F' : ''}${protectionSection.isLong ? 'L' : ''}'), | ||
], | ||
), | ||
); | ||
} | ||
|
||
@override | ||
DASTableCell iconsCell2(BuildContext context) { | ||
return DASTableCell( | ||
child: SvgPicture.asset( | ||
AppAssets.iconProtectionSection, | ||
key: protectionSectionKey, | ||
), | ||
alignment: Alignment.bottomCenter); | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
enum Datatype { | ||
servicePoint; | ||
servicePoint, | ||
protectionSection; | ||
} |
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,10 @@ | ||
import 'package:das_client/model/journey/base_data.dart'; | ||
import 'package:das_client/model/journey/datatype.dart'; | ||
|
||
class ProtectionSection extends BaseData { | ||
ProtectionSection({required this.isOptional, required this.isLong, required super.order, required super.kilometre}) | ||
: super(type: Datatype.protectionSection); | ||
|
||
final bool isOptional; | ||
final bool isLong; | ||
} |
Oops, something went wrong.