Added flexibleBottomSheet for timetable details

This commit is contained in:
Elias Müller 2023-09-12 13:49:30 +02:00
parent ab2bead0b5
commit d4c0499e6d
2 changed files with 63 additions and 54 deletions

View File

@ -1,4 +1,5 @@
import 'package:bottom_sheet/bottom_sheet.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart';
@ -19,10 +20,10 @@ class AppointmentDetails {
if(code == "irregular") return "Änderung: ";
return code ?? "";
}
static void show(BuildContext context, TimetableProps webuntisData, Appointment appointment) {
GetTimetableResponseObject timetableData = appointment.id as GetTimetableResponseObject;
//GetTimetableResponseObject timetableData = webuntisData.getTimetableResponse.result.firstWhere((element) => element.id == timetableObject.id);
GetSubjectsResponseObject subject;
GetRoomsResponseObject room;
@ -38,65 +39,72 @@ class AppointmentDetails {
room = GetRoomsResponseObject(0, "?", "Unbekannt", true, "?");
}
showModalBottomSheet(context: context, builder: (context) => Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 30),
child: Center(
child: Column(
children: [
Icon(Icons.info, color: appointment.color),
const SizedBox(height: 10),
Text("${_getEventPrefix(timetableData.code)}${subject.alternateName} - (${subject.longName})", style: const TextStyle(fontSize: 30)),
Text("${Jiffy.parseFromDateTime(appointment.startTime).format(pattern: "HH:mm")} - ${Jiffy.parseFromDateTime(appointment.endTime).format(pattern: "HH:mm")}", style: const TextStyle(fontSize: 15)),
],
showFlexibleBottomSheet(
minHeight: 0,
initHeight: 0.5,
maxHeight: 0.8,
anchors: [0, 0.5, 0.8],
isSafeArea: true,
context: context,
builder: (context, scrollController, bottomSheetOffset) => Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 30),
child: Center(
child: Column(
children: [
Text("${_getEventPrefix(timetableData.code)}${subject.alternateName} - (${subject.longName})", style: const TextStyle(fontSize: 30)),
Text("${Jiffy.parseFromDateTime(appointment.startTime).format(pattern: "HH:mm")} - ${Jiffy.parseFromDateTime(appointment.endTime).format(pattern: "HH:mm")}", style: const TextStyle(fontSize: 15)),
],
),
),
),
),
Expanded(
child: ListView(
children: [
ListTile(
leading: const Icon(Icons.notifications_active),
title: Text("Status: ${timetableData.code != null ? "Geändert" : "Regulär"}"),
),
ListTile(
leading: const Icon(Icons.room),
title: Text("Raum: ${room.name}"),
trailing: IconButton(
icon: const Icon(Icons.house_outlined),
onPressed: () {
PersistentNavBarNavigator.pushNewScreen(context, withNavBar: false, screen: const Roomplan());
},
Expanded(
child: ListView(
children: [
ListTile(
leading: const Icon(Icons.notifications_active),
title: Text("Status: ${timetableData.code != null ? "Geändert" : "Regulär"}"),
),
),
ListTile(
leading: const Icon(Icons.person),
title: Text("Lehrkraft: (${timetableData.te[0].name}) ${timetableData.te[0].longname}"),
trailing: Visibility(
visible: !kReleaseMode,
child: IconButton(
icon: const Icon(Icons.textsms_outlined),
ListTile(
leading: const Icon(Icons.room),
title: Text("Raum: ${room.name}"),
trailing: IconButton(
icon: const Icon(Icons.house_outlined),
onPressed: () {
UnimplementedDialog.show(context);
PersistentNavBarNavigator.pushNewScreen(context, withNavBar: false, screen: const Roomplan());
},
),
),
),
ListTile(
leading: const Icon(Icons.abc),
title: Text("Typ: ${timetableData.activityType}"),
),
ListTile(
leading: const Icon(Icons.people),
title: Text("Klasse(n): ${timetableData.kl.map((e) => e.name).join(", ")}"),
),
DebugTile(context).jsonData(timetableData.toJson()),
],
),
)
],
));
ListTile(
leading: const Icon(Icons.person),
title: Text("Lehrkraft: (${timetableData.te[0].name}) ${timetableData.te[0].longname}"),
trailing: Visibility(
visible: !kReleaseMode,
child: IconButton(
icon: const Icon(Icons.textsms_outlined),
onPressed: () {
UnimplementedDialog.show(context);
},
),
),
),
ListTile(
leading: const Icon(Icons.abc),
title: Text("Typ: ${timetableData.activityType}"),
),
ListTile(
leading: const Icon(Icons.people),
title: Text("Klasse(n): ${timetableData.kl.map((e) => e.name).join(", ")}"),
),
DebugTile(context).jsonData(timetableData.toJson()),
],
),
)
],
),
);
}
}

View File

@ -56,7 +56,7 @@ dependencies:
git:
url: https://github.com/provokateurin/nextcloud-neon
path: packages/nextcloud
ref: ba151505ab7f9d4c356345625482e2b61ce460cb
ref: 1d2f4703046f3bb4e5566758ed1ae5499c9006aa
flutter_launcher_icons: ^0.13.1
pretty_json: ^2.0.0
cached_network_image: ^3.2.3
@ -89,6 +89,7 @@ dependencies:
fast_rsa: ^3.6.1
share_plus: ^7.1.0
flutter_split_view: ^0.1.2
bottom_sheet: ^4.0.0
dev_dependencies:
flutter_test: