replaced generic "Event" label with substitution or lesson text
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import '../../../../api/marianumconnect/queries/timetable_get_week/timetable_get_week_response.dart';
|
||||
import 'lesson_labels.dart';
|
||||
|
||||
/// Derives a human-readable title from the Marianum-Connect `lessonType` for
|
||||
/// lessons that have no subject of their own (Aufsicht, Sprechstunde, …).
|
||||
@@ -10,10 +11,20 @@ class LessonTypeLabel {
|
||||
|
||||
static String forEntry(McTimetableEntry lesson) {
|
||||
final base = baseLabel(lesson.lessonType);
|
||||
if (base == fallback) {
|
||||
final text = entryText(lesson);
|
||||
if (text != null) return text;
|
||||
}
|
||||
final room = (lesson.rooms.firstOrNull ?? '').trim();
|
||||
return room.isEmpty ? base : '$room $base';
|
||||
}
|
||||
|
||||
/// Webuntis-Freitext eines fachlosen Eintrags („Klassenfahrt 8a“), der
|
||||
/// aussagekräftiger ist als das generische „Event“.
|
||||
static String? entryText(McTimetableEntry lesson) =>
|
||||
collapseWhitespace(lesson.substitutionText) ??
|
||||
collapseWhitespace(lesson.lessonText);
|
||||
|
||||
/// Returns just the type wording without the room — useful when the caller
|
||||
/// renders the room separately (e.g. as a subtitle line).
|
||||
static String baseLabel(String lessonType) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import '../../../../state/app/modules/timetable/bloc/timetable_bloc.dart';
|
||||
import '../../../../state/app/modules/timetable/bloc/timetable_state.dart';
|
||||
import '../../../../widget/debug/debug_tile.dart';
|
||||
import '../../../../widget/details_bottom_sheet.dart';
|
||||
import '../data/lesson_labels.dart';
|
||||
import '../data/lesson_type_label.dart';
|
||||
import '../subject_colors/subject_color_picker.dart';
|
||||
|
||||
@@ -226,10 +227,13 @@ class LessonSheet {
|
||||
}
|
||||
|
||||
static List<Widget> _optionalTextTiles(McTimetableEntry lesson) {
|
||||
final sameText =
|
||||
collapseWhitespace(lesson.lessonText) ==
|
||||
collapseWhitespace(lesson.substitutionText);
|
||||
return <Widget?>[
|
||||
_textTile(Icons.info_outline, 'Info', lesson.infoText),
|
||||
_textTile(Icons.swap_horiz, 'Vertretungstext', lesson.substitutionText),
|
||||
_textTile(Icons.subject, 'Stundentext', lesson.lessonText),
|
||||
if (!sameText) _textTile(Icons.subject, 'Stundentext', lesson.lessonText),
|
||||
_textTile(
|
||||
Icons.category_outlined,
|
||||
'Stundentyp',
|
||||
|
||||
Reference in New Issue
Block a user