diff --git a/lib/app.dart b/lib/app.dart index 7b506f2..8eb1f35 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -3,7 +3,7 @@ import 'dart:async'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; -import 'package:persistent_bottom_nav_bar/persistent_tab_view.dart'; +import 'package:persistent_bottom_nav_bar_v2/persistent-tab-view.dart'; import 'package:provider/provider.dart'; import 'package:badges/badges.dart' as badges; @@ -75,11 +75,11 @@ class _AppState extends State { navBarStyle: NavBarStyle.style6, hideNavigationBarWhenKeyboardShows: true, navBarHeight: MediaQuery.of(context).viewInsets.bottom > 0 ? 0.0 : kBottomNavigationBarHeight, - backgroundColor: Theme.of(context).colorScheme.surface, + backgroundColor: Theme.of(context).colorScheme.background, decoration: const NavBarDecoration( border: Border(top: BorderSide(width: 1, color: Colors.grey)), ), - screenTransitionAnimation: const ScreenTransitionAnimation(animateTabTransition: true, curve: Curves.ease, duration: Duration(milliseconds: 200)), + screenTransitionAnimation: const ScreenTransitionAnimation(animateTabTransition: true, curve: Curves.ease, duration: Duration(milliseconds: 150)), screens: const [ Breaker(breaker: BreakerArea.timetable, child: Timetable()), Breaker(breaker: BreakerArea.talk, child: ChatList()), diff --git a/lib/theming/darkAppTheme.dart b/lib/theming/darkAppTheme.dart index 156b234..a8d33e5 100644 --- a/lib/theming/darkAppTheme.dart +++ b/lib/theming/darkAppTheme.dart @@ -4,51 +4,10 @@ class DarkAppTheme { static const Color marianumRed = Color.fromARGB(255, 153, 51, 51); static final theme = ThemeData( - useMaterial3: false, - brightness: Brightness.dark, - primaryColor: marianumRed, - hintColor: marianumRed, - colorScheme: const ColorScheme( + colorScheme: ColorScheme.fromSeed( + seedColor: marianumRed, brightness: Brightness.dark, - - surface: Colors.black54, - onSurface: Colors.white, - - primary: marianumRed, - onPrimary: Colors.white, - - secondary: Colors.grey, - onSecondary: Colors.white, - - background: Colors.black26, - onBackground: Colors.white, - - error: marianumRed, - onError: marianumRed, - ), - inputDecorationTheme: const InputDecorationTheme( - border: UnderlineInputBorder(borderSide: BorderSide(color: marianumRed)), - ), - appBarTheme: const AppBarTheme( - backgroundColor: marianumRed, - ), - progressIndicatorTheme: const ProgressIndicatorThemeData( - color: marianumRed, - ), - iconButtonTheme: IconButtonThemeData( - style: ButtonStyle( - textStyle: MaterialStateProperty.all(const TextStyle(color: Colors.white)), - backgroundColor: MaterialStateProperty.all(Colors.white), - ) - ), - checkboxTheme: CheckboxThemeData( - fillColor: MaterialStateProperty.resolveWith((states) => states.contains(MaterialState.selected) ? marianumRed : Colors.transparent), - ), - textButtonTheme: TextButtonThemeData( - style: TextButton.styleFrom( - foregroundColor: Colors.white, - backgroundColor: marianumRed.withOpacity(0.5), - ), ), + primaryColor: marianumRed, ); } \ No newline at end of file diff --git a/lib/theming/lightAppTheme.dart b/lib/theming/lightAppTheme.dart index 9ce27ee..09a707a 100644 --- a/lib/theming/lightAppTheme.dart +++ b/lib/theming/lightAppTheme.dart @@ -4,39 +4,10 @@ class LightAppTheme { static const Color marianumRed = Color.fromARGB(255, 153, 51, 51); static final theme = ThemeData( - useMaterial3: false, brightness: Brightness.light, - primaryColor: marianumRed, - - colorScheme: const ColorScheme( - brightness: Brightness.light, - - surface: Colors.white, - onSurface: Colors.black, - - secondary: Colors.grey, - onSecondary: Colors.white, - - primary: marianumRed, - onPrimary: Colors.white, - - background: Colors.white, - onBackground: Colors.black, - - error: marianumRed, - onError: marianumRed, - ), - inputDecorationTheme: const InputDecorationTheme( - border: UnderlineInputBorder(borderSide: BorderSide(color: marianumRed)), - ), - appBarTheme: const AppBarTheme( - backgroundColor: marianumRed, - ), - progressIndicatorTheme: const ProgressIndicatorThemeData( - color: marianumRed, - ), - checkboxTheme: CheckboxThemeData( - fillColor: MaterialStateProperty.resolveWith((states) => states.contains(MaterialState.selected) ? marianumRed : Colors.transparent), - ), + colorScheme: ColorScheme.fromSeed(seedColor: marianumRed), + floatingActionButtonTheme: const FloatingActionButtonThemeData( + foregroundColor: Colors.white + ) ); } \ No newline at end of file diff --git a/lib/view/pages/more/overhang.dart b/lib/view/pages/more/overhang.dart index e5cb068..c7fb4d9 100644 --- a/lib/view/pages/more/overhang.dart +++ b/lib/view/pages/more/overhang.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:persistent_bottom_nav_bar/persistent_tab_view.dart'; +import 'package:persistent_bottom_nav_bar_v2/persistent-tab-view.dart'; import '../../../widget/ListItem.dart'; import '../../settings/settings.dart'; @@ -20,7 +20,7 @@ class Overhang extends StatelessWidget { appBar: AppBar( title: const Text("Mehr"), actions: [ - IconButton(onPressed: () => PersistentNavBarNavigator.pushNewScreen(context, screen: const Settings(), withNavBar: false), icon: const Icon(Icons.settings)) + IconButton(onPressed: () => pushNewScreen(context, screen: const Settings(), withNavBar: false), icon: const Icon(Icons.settings)) ], ), body: ListView( diff --git a/lib/view/pages/talk/components/chatTextfield.dart b/lib/view/pages/talk/components/chatTextfield.dart index d79aab3..35fe84f 100644 --- a/lib/view/pages/talk/components/chatTextfield.dart +++ b/lib/view/pages/talk/components/chatTextfield.dart @@ -84,9 +84,8 @@ class _ChatTextfieldState extends State { Align( alignment: Alignment.bottomLeft, child: Container( - padding: const EdgeInsets.only(left: 10, bottom: 1, top: 1, right: 10), + padding: const EdgeInsets.only(left: 10, bottom: 3, top: 3, right: 10), width: double.infinity, - color: Theme.of(context).primaryColor, child: Row( children: [ GestureDetector( @@ -135,7 +134,7 @@ class _ChatTextfieldState extends State { color: Theme.of(context).primaryColor, borderRadius: BorderRadius.circular(30), ), - child: const Icon(Icons.add, color: Colors.white, size: 20, ), + child: const Icon(Icons.attach_file_outlined, color: Colors.white, size: 20, ), ), ) ), @@ -144,18 +143,13 @@ class _ChatTextfieldState extends State { child: TextField( autocorrect: true, textCapitalization: TextCapitalization.sentences, - style: const TextStyle( - color: Colors.white, - ), controller: _textBoxController, maxLines: 7, minLines: 1, - decoration: InputDecoration( + decoration: const InputDecoration( hintText: "Nachricht schreiben...", - hintStyle: TextStyle(color: Theme.of(context).colorScheme.onSecondary), border: InputBorder.none, ), - cursorColor: Colors.white, onChanged: (String text) { if(text.trim().toLowerCase() == "marbot marbot marbot") { var newText = "Roboter sind cool und so, aber marbots sind besser!"; diff --git a/lib/view/pages/talk/talkNavigator.dart b/lib/view/pages/talk/talkNavigator.dart index 433ace3..b52661a 100644 --- a/lib/view/pages/talk/talkNavigator.dart +++ b/lib/view/pages/talk/talkNavigator.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_split_view/flutter_split_view.dart'; -import 'package:persistent_bottom_nav_bar/persistent_tab_view.dart'; +import 'package:persistent_bottom_nav_bar_v2/persistent-tab-view.dart'; class TalkNavigator { static bool hasSplitViewState(BuildContext context) => context.findAncestorStateOfType() != null; @@ -12,7 +12,7 @@ class TalkNavigator { SplitViewState splitView = SplitView.of(context); overrideToSingleSubScreen ? splitView.setSecondary(view) : splitView.push(view); } else { - PersistentNavBarNavigator.pushNewScreen(context, screen: view, withNavBar: false); + pushNewScreen(context, screen: view, withNavBar: false); } } } \ No newline at end of file diff --git a/lib/view/pages/timetable/appointmenetComponent.dart b/lib/view/pages/timetable/appointmenetComponent.dart index ba11f3d..5f10906 100644 --- a/lib/view/pages/timetable/appointmenetComponent.dart +++ b/lib/view/pages/timetable/appointmenetComponent.dart @@ -18,10 +18,6 @@ class _AppointmentComponentState extends State { 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 { 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 { 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 { ), ), ), - 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( diff --git a/lib/view/pages/timetable/appointmentDetails.dart b/lib/view/pages/timetable/appointmentDetails.dart index dd3265d..dbfa099 100644 --- a/lib/view/pages/timetable/appointmentDetails.dart +++ b/lib/view/pages/timetable/appointmentDetails.dart @@ -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( diff --git a/lib/view/pages/timetable/timetable.dart b/lib/view/pages/timetable/timetable.dart index b79ebf4..9c4b086 100644 --- a/lib/view/pages/timetable/timetable.dart +++ b/lib/view/pages/timetable/timetable.dart @@ -156,10 +156,9 @@ class _TimetableState extends State { } List _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 holidayList = holidays.result.map((holiday) { DateTime startDay = _parseWebuntisTimestamp(holiday.startDate, 0); @@ -193,7 +192,7 @@ class _TimetableState extends State { 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 { 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", - ), ]; } diff --git a/lib/view/settings/settings.dart b/lib/view/settings/settings.dart index cfe0374..58d8abc 100644 --- a/lib/view/settings/settings.dart +++ b/lib/view/settings/settings.dart @@ -1,7 +1,9 @@ import 'package:filesize/filesize.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:jiffy/jiffy.dart'; import 'package:package_info/package_info.dart'; import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -186,11 +188,11 @@ class _SettingsState extends State { context: context, applicationIcon: const Icon(Icons.apps), applicationName: "MarianumMobile", - applicationVersion: "${appInfo.appName}\n\nPackage: ${appInfo.packageName}\n\nVersion: ${appInfo.version}\nBuild: ${appInfo.buildNumber}", + applicationVersion: "${appInfo.appName}\n\nPackage: ${appInfo.packageName}\nVersion: ${appInfo.version}\nBuild: ${appInfo.buildNumber}", applicationLegalese: "Dies ist ein Inoffizieller Nextcloud & Webuntis Client und wird nicht vom Marianum selbst betrieben.\n" "Keinerlei Gewähr für Vollständigkeit, Richtigkeit und Aktualität!\n\n" - "Development build\n" - "Marianum Fulda 2023 Elias Müller", + "${kReleaseMode ? "Production" : "Development"} build\n" + "Marianum Fulda 2023-${Jiffy.now().year}\nElias Müller", ); }); }, diff --git a/pubspec.yaml b/pubspec.yaml index d0bd123..dd5135f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 0.0.5+29 +version: 0.0.6+30 environment: sdk: '>3.0.0' @@ -68,7 +68,7 @@ dependencies: flowder: git: url: https://github.com/Harsh223/flowder.git - persistent_bottom_nav_bar: ^5.0.2 + persistent_bottom_nav_bar_v2: ^4.2.8 badges: ^3.0.2 image_picker: ^1.0.0 file_picker: ^6.1.1