#23 Upgrade MaterialUI

General UI improvements and cleanup
This commit is contained in:
2024-02-07 21:17:30 +01:00
parent 538ebd27bf
commit 095b663bf1
11 changed files with 43 additions and 173 deletions

View File

@ -18,10 +18,6 @@ class _AppointmentComponentState extends State<AppointmentComponent> {
Widget build(BuildContext context) {
final Appointment meeting = widget.details.appointments.first;
final appointmentHeight = widget.details.bounds.height;
double headerHeight = 50;
const double footerHeight = 5;
final double infoHeight = appointmentHeight - (headerHeight + footerHeight);
if (infoHeight < 0) headerHeight += infoHeight;
return Stack(
children: [
@ -29,14 +25,11 @@ class _AppointmentComponentState extends State<AppointmentComponent> {
children: [
Container(
padding: const EdgeInsets.all(3),
height: headerHeight,
height: appointmentHeight,
alignment: Alignment.topLeft,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(5),
topRight: Radius.circular(5),
),
borderRadius: const BorderRadius.all(Radius.circular(5)),
color: meeting.color,
),
child: SingleChildScrollView(
@ -60,7 +53,7 @@ class _AppointmentComponentState extends State<AppointmentComponent> {
FittedBox(
fit: BoxFit.fitWidth,
child: Text(
meeting.location ?? "?",
meeting.location ?? "-",
maxLines: 3,
overflow: TextOverflow.ellipsis,
softWrap: true,
@ -74,45 +67,6 @@ class _AppointmentComponentState extends State<AppointmentComponent> {
),
),
),
Visibility(
visible: meeting.notes != null && infoHeight > 10,
replacement: Container(
color: meeting.color,
height: infoHeight,
),
child: Container(
height: infoHeight,
padding: const EdgeInsets.fromLTRB(3, 5, 3, 2),
color: meeting.color.withOpacity(0.8),
alignment: Alignment.topLeft,
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
meeting.notes ?? "",
style: const TextStyle(
color: Colors.white,
fontSize: 10,
),
)
],
),
),
),
),
Container(
height: footerHeight,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(5),
bottomRight: Radius.circular(5),
),
color: meeting.color,
),
),
],
),
Visibility(

View File

@ -3,7 +3,7 @@ import 'package:bottom_sheet/bottom_sheet.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart';
import 'package:persistent_bottom_nav_bar/persistent_tab_view.dart';
import 'package:persistent_bottom_nav_bar_v2/persistent-tab-view.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
import '../../../api/webuntis/queries/getRooms/getRoomsResponse.dart';
@ -49,20 +49,18 @@ class AppointmentDetails {
maxHeaderHeight: 150,
context: context,
headerBuilder: (context, bottomSheetOffset) => Padding(
padding: const EdgeInsets.symmetric(vertical: 30),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
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)),
],
),
headerBuilder: (context, bottomSheetOffset) => Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text("${_getEventPrefix(timetableData.code)}${subject.alternateName} - (${subject.longName})", style: const TextStyle(fontSize: 25), overflow: TextOverflow.ellipsis),
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(
[
const Divider(),
ListTile(
leading: const Icon(Icons.notifications_active),
title: Text("Status: ${timetableData.code != null ? "Geändert" : "Regulär"}"),
@ -73,13 +71,15 @@ class AppointmentDetails {
trailing: IconButton(
icon: const Icon(Icons.house_outlined),
onPressed: () {
PersistentNavBarNavigator.pushNewScreen(context, withNavBar: false, screen: const Roomplan());
pushNewScreen(context, withNavBar: false, screen: const Roomplan());
},
),
),
ListTile(
leading: const Icon(Icons.person),
title: Text("Lehrkraft: ${timetableData.te[0].name} ${timetableData.te[0].longname.isNotEmpty ? "(${timetableData.te[0].longname})" : ""}"),
title: timetableData.te.isNotEmpty
? Text("Lehrkraft: ${timetableData.te[0].name} ${timetableData.te[0].longname.isNotEmpty ? "(${timetableData.te[0].longname})" : ""}")
: const Text("?"),
trailing: Visibility(
visible: !kReleaseMode,
child: IconButton(

View File

@ -156,10 +156,9 @@ class _TimetableState extends State<Timetable> {
}
List<TimeRegion> _buildSpecialTimeRegions(GetHolidaysResponse holidays) {
DateTime lastMonday = DateTime.now().subtract(Duration(days: DateTime.now().weekday - 1));
DateTime lastMonday = DateTime.now().subtract(const Duration(days: 14)).nextWeekday(DateTime.monday);
DateTime firstBreak = lastMonday.copyWith(hour: 10, minute: 15);
DateTime secondBreak = lastMonday.copyWith(hour: 13, minute: 50);
DateTime beforeSchool = lastMonday.copyWith(hour: 7, minute: 30);
Iterable<TimeRegion> holidayList = holidays.result.map((holiday) {
DateTime startDay = _parseWebuntisTimestamp(holiday.startDate, 0);
@ -193,7 +192,7 @@ class _TimetableState extends State<Timetable> {
TimeRegion(
startTime: firstBreak,
endTime: firstBreak.add(const Duration(minutes: 20)),
recurrenceRule: 'FREQ=DAILY;INTERVAL=1;COUNT=5',
recurrenceRule: 'FREQ=DAILY;INTERVAL=1',
text: 'centerIcon',
color: Theme.of(context).primaryColor.withAlpha(50),
iconData: Icons.restaurant
@ -203,20 +202,11 @@ class _TimetableState extends State<Timetable> {
TimeRegion(
startTime: secondBreak,
endTime: secondBreak.add(const Duration(minutes: 15)),
recurrenceRule: 'FREQ=DAILY;INTERVAL=1;COUNT=5',
recurrenceRule: 'FREQ=DAILY;INTERVAL=1',
text: 'centerIcon',
color: Theme.of(context).primaryColor.withAlpha(50),
iconData: Icons.restaurant
),
if(!isInHoliday(beforeSchool))
TimeRegion(
startTime: beforeSchool,
endTime: beforeSchool.add(const Duration(minutes: 25)),
recurrenceRule: 'FREQ=DAILY;INTERVAL=1;COUNT=5',
color: Theme.of(context).disabledColor.withAlpha(50),
text: "centerIcon",
),
];
}