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,15 +39,21 @@ class AppointmentDetails {
room = GetRoomsResponseObject(0, "?", "Unbekannt", true, "?"); room = GetRoomsResponseObject(0, "?", "Unbekannt", true, "?");
} }
showModalBottomSheet(context: context, builder: (context) => Column( 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: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric(vertical: 30), padding: const EdgeInsets.symmetric(vertical: 30),
child: Center( child: Center(
child: Column( child: Column(
children: [ 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("${_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)), Text("${Jiffy.parseFromDateTime(appointment.startTime).format(pattern: "HH:mm")} - ${Jiffy.parseFromDateTime(appointment.endTime).format(pattern: "HH:mm")}", style: const TextStyle(fontSize: 15)),
], ],
@ -97,6 +104,7 @@ class AppointmentDetails {
), ),
) )
], ],
)); ),
);
} }
} }

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: