dart format
This commit is contained in:
@@ -14,13 +14,30 @@ import '../../../../widget/details_bottom_sheet.dart';
|
||||
import '../../../../widget/unimplemented_dialog.dart';
|
||||
|
||||
class WebuntisLessonSheet {
|
||||
static void show(BuildContext context, TimetableBloc bloc, Appointment appointment, GetTimetableResponseObject lesson) {
|
||||
static void show(
|
||||
BuildContext context,
|
||||
TimetableBloc bloc,
|
||||
Appointment appointment,
|
||||
GetTimetableResponseObject lesson,
|
||||
) {
|
||||
final state = bloc.state.data;
|
||||
if (state == null) return;
|
||||
|
||||
final headerSubject = LessonResolver.resolveSubject(state, lesson.su.firstOrNull?.id);
|
||||
final headerTitle = firstNonEmpty([headerSubject.alternateName, headerSubject.name, headerSubject.longName, '?']);
|
||||
final headerLongName = headerSubject.longName.isNotEmpty && headerSubject.longName != headerTitle ? headerSubject.longName : '';
|
||||
final headerSubject = LessonResolver.resolveSubject(
|
||||
state,
|
||||
lesson.su.firstOrNull?.id,
|
||||
);
|
||||
final headerTitle = firstNonEmpty([
|
||||
headerSubject.alternateName,
|
||||
headerSubject.name,
|
||||
headerSubject.longName,
|
||||
'?',
|
||||
]);
|
||||
final headerLongName =
|
||||
headerSubject.longName.isNotEmpty &&
|
||||
headerSubject.longName != headerTitle
|
||||
? headerSubject.longName
|
||||
: '';
|
||||
|
||||
final timeRange = appointment.startTime.timeRangeTo(appointment.endTime);
|
||||
|
||||
@@ -32,9 +49,9 @@ class WebuntisLessonSheet {
|
||||
'${LessonFormatter.codePrefix(lesson.code)}$headerTitle',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
subtitle: Text(headerLongName.isNotEmpty
|
||||
? '$timeRange\n$headerLongName'
|
||||
: timeRange),
|
||||
subtitle: Text(
|
||||
headerLongName.isNotEmpty ? '$timeRange\n$headerLongName' : timeRange,
|
||||
),
|
||||
isThreeLine: headerLongName.isNotEmpty,
|
||||
),
|
||||
children: (_) => <Widget>[
|
||||
@@ -66,10 +83,12 @@ class WebuntisLessonSheet {
|
||||
icon: Icons.people,
|
||||
label: lesson.kl.length == 1 ? 'Klasse' : 'Klassen',
|
||||
entries: lesson.kl
|
||||
.map((k) => LessonFormatter.formatLine(
|
||||
k.name.isNotEmpty ? k.name : '?',
|
||||
longname: k.longname,
|
||||
))
|
||||
.map(
|
||||
(k) => LessonFormatter.formatLine(
|
||||
k.name.isNotEmpty ? k.name : '?',
|
||||
longname: k.longname,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
..._optionalTextTiles(lesson),
|
||||
@@ -78,7 +97,11 @@ class WebuntisLessonSheet {
|
||||
);
|
||||
}
|
||||
|
||||
static Widget _roomTile(BuildContext context, TimetableState state, GetTimetableResponseObject lesson) {
|
||||
static Widget _roomTile(
|
||||
BuildContext context,
|
||||
TimetableState state,
|
||||
GetTimetableResponseObject lesson,
|
||||
) {
|
||||
final trailing = IconButton(
|
||||
icon: const Icon(Icons.house_outlined),
|
||||
onPressed: () => AppRoutes.openRoomplan(context),
|
||||
@@ -112,7 +135,10 @@ class WebuntisLessonSheet {
|
||||
);
|
||||
}
|
||||
|
||||
static Widget _teacherTile(BuildContext context, GetTimetableResponseObject lesson) {
|
||||
static Widget _teacherTile(
|
||||
BuildContext context,
|
||||
GetTimetableResponseObject lesson,
|
||||
) {
|
||||
final trailing = Visibility(
|
||||
visible: !kReleaseMode,
|
||||
child: IconButton(
|
||||
|
||||
Reference in New Issue
Block a user