Added flexibleBottomSheet for timetable details

This commit is contained in:
Elias Müller 2023-09-12 13:49:30 +02:00
parent ab2bead0b5
commit 35df3a50be
2 changed files with 63 additions and 58 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,25 +39,30 @@ class AppointmentDetails {
room = GetRoomsResponseObject(0, "?", "Unbekannt", true, "?"); room = GetRoomsResponseObject(0, "?", "Unbekannt", true, "?");
} }
showModalBottomSheet(context: context, builder: (context) => Column( showStickyFlexibleBottomSheet(
children: [ minHeight: 0,
Padding( initHeight: 0.4,
maxHeight: 0.7,
anchors: [0, 0.4, 0.7],
isSafeArea: true,
maxHeaderHeight: 150,
context: context,
headerBuilder: (context, bottomSheetOffset) => Padding(
padding: const EdgeInsets.symmetric(vertical: 30), padding: const EdgeInsets.symmetric(vertical: 30),
child: Center( child: Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min,
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)),
], ],
), ),
), ),
), ),
bodyBuilder: (context, bottomSheetOffset) => SliverChildListDelegate(
Expanded( [
child: ListView(
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"}"),
@ -95,8 +101,6 @@ class AppointmentDetails {
DebugTile(context).jsonData(timetableData.toJson()), 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: