-
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.
- Loading branch information
Showing
17 changed files
with
290 additions
and
54 deletions.
There are no files selected for viewing
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
68 changes: 68 additions & 0 deletions
68
...nt/lib/app/pages/journey/train_journey/widgets/table/balise_level_crossing_group_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,68 @@ | ||
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/balise.dart'; | ||
import 'package:das_client/model/journey/balise_level_crossing_group.dart'; | ||
import 'package:das_client/model/journey/level_crossing.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_svg/svg.dart'; | ||
import 'package:sbb_design_system_mobile/sbb_design_system_mobile.dart'; | ||
|
||
class BaliseLevelCrossingGroupRow extends BaseRowBuilder<BaliseLevelCrossingGroup> { | ||
static const Key baliseIconKey = Key('balise_icon_key'); | ||
|
||
BaliseLevelCrossingGroupRow({ | ||
required super.metadata, | ||
required super.data, | ||
required super.settings, | ||
super.trackEquipmentRenderData, | ||
super.onTap, | ||
}); | ||
|
||
@override | ||
DASTableCell informationCell(BuildContext context) { | ||
if (_baliseCount == 0) { | ||
return DASTableCell( | ||
child: Text('$_levelCrossingCount ${context.l10n.p_train_journey_table_level_crossing}'), | ||
alignment: Alignment.centerLeft, | ||
); | ||
} else if (_baliseCount == 1 && _levelCrossingCount > 1) { | ||
return DASTableCell( | ||
child: Text('($_levelCrossingCount ${context.l10n.p_train_journey_table_level_crossing})'), | ||
alignment: Alignment.centerRight, | ||
); | ||
} else { | ||
return DASTableCell( | ||
child: Row( | ||
children: [ | ||
Text(_levelCrossingCount > 0 ? context.l10n.p_train_journey_table_level_crossing : ''), | ||
Spacer(), | ||
Text(_baliseCount.toString()), | ||
], | ||
), | ||
alignment: Alignment.centerRight, | ||
); | ||
} | ||
} | ||
|
||
@override | ||
DASTableCell iconsCell2(BuildContext context) { | ||
if (_baliseCount > 0) { | ||
return DASTableCell( | ||
padding: EdgeInsets.all(sbbDefaultSpacing * 0.25), | ||
child: SvgPicture.asset( | ||
AppAssets.iconBalise, | ||
key: baliseIconKey, | ||
), | ||
alignment: Alignment.centerLeft, | ||
); | ||
} else { | ||
return DASTableCell.empty(); | ||
} | ||
} | ||
|
||
int get _baliseCount => data.groupedElements.whereType<Balise>().length; | ||
|
||
int get _levelCrossingCount => data.groupedElements.whereType<LevelCrossing>().length; | ||
} |
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
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
Oops, something went wrong.