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