From e577e6df23eac7d2a9237870178c64742d67078e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Wed, 1 Nov 2023 19:10:26 +0100 Subject: [PATCH] Fix Calendar Decoding, Optimize Error Handling, Fix Movie Cards (#153) --- lib/base/enums/error_handling_view_type.dart | 7 ++ lib/base/localization/l10n/app_de.arb | 1 + lib/base/localization/l10n/app_en.arb | 1 + lib/base/networking/protocols/main_api.dart | 8 +- lib/base/views/error_handling_view.dart | 88 +++++++++++++++---- .../model/calendar_event.dart | 17 ++-- .../model/calendar_event.g.dart | 8 +- .../views/appointment_view.dart | 5 +- .../views/calendars_view.dart | 9 +- .../calendar_widget_event_view.dart | 4 +- .../homeWidget/calendar_widget_view.dart | 1 + .../views/departures_details_view.dart | 1 + .../homeWidget/departures_widget_view.dart | 1 + lib/gradeComponent/views/grades_view.dart | 1 + .../widgetComponent/views/widget_screen.dart | 1 + .../views/lecture_details_view.dart | 1 + .../views/lecture_meeting_info_view.dart | 3 +- lib/lectureComponent/views/lectures_view.dart | 1 + lib/loginComponent/views/confirm_view.dart | 1 + lib/loginComponent/views/login_view.dart | 1 + .../views/homeWidget/movie_card_view.dart | 2 +- .../views/homeWidget/movies_widget_view.dart | 1 + .../views/navigatum_room_view.dart | 1 + .../views/homeWidget/news_widget_view.dart | 1 + .../views/person_details_view.dart | 1 + .../services/mealplan_service.dart | 2 - .../views/cafeterias/cafeteria_view.dart | 1 + .../views/cafeterias/cafeterias_view.dart | 1 + .../homeWidget/cafeteria_widget_view.dart | 1 + .../homeWidget/study_room_widget_view.dart | 1 + lib/placesComponent/views/places_screen.dart | 1 + .../studyGroups/study_room_group_view.dart | 1 + .../views/studyGroups/study_rooms_view.dart | 1 + .../calendar_search_result_view.dart | 4 +- .../search_result_card_view.dart | 1 + .../views/personRoomSearch/search_view.dart | 1 + lib/theme.dart | 10 +++ 37 files changed, 146 insertions(+), 45 deletions(-) create mode 100644 lib/base/enums/error_handling_view_type.dart diff --git a/lib/base/enums/error_handling_view_type.dart b/lib/base/enums/error_handling_view_type.dart new file mode 100644 index 00000000..89ea40b7 --- /dev/null +++ b/lib/base/enums/error_handling_view_type.dart @@ -0,0 +1,7 @@ +enum ErrorHandlingViewType { + fullScreen, + fullScreenNoImage, + textOnly, + descriptionOnly, + redDescriptionOnly +} diff --git a/lib/base/localization/l10n/app_de.arb b/lib/base/localization/l10n/app_de.arb index a7247fad..609e7617 100644 --- a/lib/base/localization/l10n/app_de.arb +++ b/lib/base/localization/l10n/app_de.arb @@ -227,6 +227,7 @@ "requestCancelled":"Anfrage abgebrochen", "pleaseReport":"Bitte melden Sie dies als Fehler \nper E-Mail oder auf GitHub", "connectionTimeout":"Zeitüberschreitung", + "decodingError":"Dekodierungsfehler", "unknownError":"Unbekannter Fehler", "monday":"Montag", "tuesday":"Dienstag", diff --git a/lib/base/localization/l10n/app_en.arb b/lib/base/localization/l10n/app_en.arb index bba939b5..4567a918 100644 --- a/lib/base/localization/l10n/app_en.arb +++ b/lib/base/localization/l10n/app_en.arb @@ -227,6 +227,7 @@ "requestCancelled":"Request Cancelled", "pleaseReport":"Please report this is as a bug \nvia Email or on GitHub", "connectionTimeout":"Connection Timeout", + "decodingError":"Decoding Error", "unknownError":"Unknown Error", "monday":"Monday", "tuesday":"Tuesday", diff --git a/lib/base/networking/protocols/main_api.dart b/lib/base/networking/protocols/main_api.dart index 384934a8..db7a6f22 100644 --- a/lib/base/networking/protocols/main_api.dart +++ b/lib/base/networking/protocols/main_api.dart @@ -121,7 +121,7 @@ class MainApi { .data; } on U catch (e) { /// rethrow error if specified error U - e.toString(); + log(e.toString()); rethrow; } catch (_) { /// catch possible decoding error and return actual expected object @@ -129,7 +129,11 @@ class MainApi { return ApiResponse.fromJson(jsonDecode(response.data.toString()), response.headers, createObject); } catch (e) { - log(e.toString()); + if (e is Error) { + log(e.stackTrace.toString()); + } else { + log(e.toString()); + } rethrow; } } diff --git a/lib/base/views/error_handling_view.dart b/lib/base/views/error_handling_view.dart index 50078863..e4a35e8b 100644 --- a/lib/base/views/error_handling_view.dart +++ b/lib/base/views/error_handling_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/extensions/custom_exception.dart'; import 'package:campus_flutter/base/networking/apis/tumOnlineApi/tum_online_api_exception.dart'; import 'package:campus_flutter/searchComponent/model/search_exception.dart'; @@ -71,6 +72,9 @@ class ErrorHandlingView extends StatelessWidget { } else if (error is CustomException) { final exception = error as CustomException; return _exceptionMessage(context, exception.message, null); + } else if (error is TypeError) { + return _exceptionMessage(context, context.localizations.decodingError, + context.localizations.pleaseReport); } else { return _exceptionMessage(context, context.localizations.unknownError, context.localizations.pleaseReport); @@ -95,11 +99,15 @@ class ErrorHandlingView extends StatelessWidget { Expanded( flex: 0, child: Column(children: [ - Text(errorMessage, - style: Theme.of(context).textTheme.titleLarge?.copyWith( - color: titleColor ?? Theme.of(context).primaryColor), - maxLines: 1, - overflow: TextOverflow.ellipsis), + _errorMessageText( + errorMessage, + context, + style: Theme.of(context).textTheme.titleLarge?.copyWith( + color: titleColor ?? Theme.of(context).primaryColor, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), if (fixMessage != null) Text(fixMessage, style: Theme.of(context) @@ -121,8 +129,9 @@ class ErrorHandlingView extends StatelessWidget { case ErrorHandlingViewType.textOnly: return Center( child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( + _errorMessageText( errorMessage, + context, style: Theme.of(context).textTheme.bodyLarge?.copyWith( color: titleColor ?? Theme.of(context).primaryColor), textAlign: TextAlign.center, @@ -135,19 +144,66 @@ class ErrorHandlingView extends StatelessWidget { ); case ErrorHandlingViewType.descriptionOnly: return Center( - child: Text(errorMessage, style: TextStyle(color: bodyColor))); + child: _errorMessageText( + errorMessage, + context, + style: TextStyle(color: bodyColor), + ), + ); case ErrorHandlingViewType.redDescriptionOnly: return Center( - child: - Text(errorMessage, style: const TextStyle(color: Colors.red))); + child: _errorMessageText( + errorMessage, + context, + style: const TextStyle(color: Colors.red), + ), + ); } } -} -enum ErrorHandlingViewType { - fullScreen, - fullScreenNoImage, - textOnly, - descriptionOnly, - redDescriptionOnly + Widget _errorMessageText(String errorMessage, BuildContext context, + {TextStyle? style, + TextAlign? textAlign, + int? maxLines, + TextOverflow? overflow}) { + return GestureDetector( + onDoubleTap: () => showStackTrace(context), + child: Text( + errorMessage, + style: style, + textAlign: textAlign, + maxLines: maxLines, + overflow: overflow, + ), + ); + } + + showStackTrace(BuildContext context) { + if (error is Error) { + showDialog( + context: context, + builder: (context) { + final split = (error as Error).stackTrace.toString().split("\n"); + return AlertDialog( + title: Text( + "Error Description", + style: Theme.of(context).textTheme.titleMedium, + textAlign: TextAlign.center, + ), + content: Text( + split.isNotEmpty + ? split.first + : (error as Error).stackTrace.toString(), + textAlign: TextAlign.center, + ), + actions: [ + ElevatedButton( + onPressed: () => Navigator.of(context).pop(), + child: const Text("Okay")) + ], + actionsAlignment: MainAxisAlignment.center, + ); + }); + } + } } diff --git a/lib/calendarComponent/model/calendar_event.dart b/lib/calendarComponent/model/calendar_event.dart index a73a6086..9f7818e9 100644 --- a/lib/calendarComponent/model/calendar_event.dart +++ b/lib/calendarComponent/model/calendar_event.dart @@ -13,22 +13,21 @@ class CalendarEvent extends Searchable { @JsonKey(name: "nr") final String id; final String status; - final String url; + final String? url; final String title; - @JsonKey(name: "description") - final String descriptionText; + final String? description; @JsonKey(name: "dtstart") final DateTime startDate; @JsonKey(name: "dtend") final DateTime endDate; - final String location; + final String? location; Duration get duration { return endDate.difference(startDate); } String? get lvNr { - return url.split("LvNr=").last; + return url?.split("LvNr=").last; } String get timePeriod { @@ -79,18 +78,18 @@ class CalendarEvent extends Searchable { @JsonKey(includeFromJson: false, includeToJson: false) List get comparisonTokens => [ ComparisonToken(value: title), - ComparisonToken(value: location), + if (location != null) ComparisonToken(value: location!), ]; CalendarEvent( {required this.id, required this.status, - required this.url, + this.url, required this.title, - required this.descriptionText, + this.description, required this.startDate, required this.endDate, - required this.location}); + this.location}); factory CalendarEvent.fromJson(Map json) => _$CalendarEventFromJson(json); diff --git a/lib/calendarComponent/model/calendar_event.g.dart b/lib/calendarComponent/model/calendar_event.g.dart index 687885fd..2b3c9f3c 100644 --- a/lib/calendarComponent/model/calendar_event.g.dart +++ b/lib/calendarComponent/model/calendar_event.g.dart @@ -10,12 +10,12 @@ CalendarEvent _$CalendarEventFromJson(Map json) => CalendarEvent( id: json['nr'] as String, status: json['status'] as String, - url: json['url'] as String, + url: json['url'] as String?, title: json['title'] as String, - descriptionText: json['description'] as String, + description: json['description'] as String?, startDate: DateTime.parse(json['dtstart'] as String), endDate: DateTime.parse(json['dtend'] as String), - location: json['location'] as String, + location: json['location'] as String?, ); Map _$CalendarEventToJson(CalendarEvent instance) => @@ -24,7 +24,7 @@ Map _$CalendarEventToJson(CalendarEvent instance) => 'status': instance.status, 'url': instance.url, 'title': instance.title, - 'description': instance.descriptionText, + 'description': instance.description, 'dtstart': instance.startDate.toIso8601String(), 'dtend': instance.endDate.toIso8601String(), 'location': instance.location, diff --git a/lib/calendarComponent/views/appointment_view.dart b/lib/calendarComponent/views/appointment_view.dart index c9d86a13..999df67f 100644 --- a/lib/calendarComponent/views/appointment_view.dart +++ b/lib/calendarComponent/views/appointment_view.dart @@ -1,4 +1,5 @@ import 'package:campus_flutter/calendarComponent/model/calendar_event.dart'; +import 'package:campus_flutter/theme.dart'; import 'package:flutter/material.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; @@ -30,7 +31,9 @@ class AppointmentView extends StatelessWidget { .compareTo(const Duration(hours: 0, minutes: 45)) > 0) _eventLocation( - calendarEvent.location, calendarEvent.isCanceled, context), + calendarEvent.location ?? context.localizations.unknown, + calendarEvent.isCanceled, + context), if (calendarEvent.endDate .difference(calendarEvent.startDate) .compareTo(const Duration(hours: 1, minutes: 30)) >= diff --git a/lib/calendarComponent/views/calendars_view.dart b/lib/calendarComponent/views/calendars_view.dart index 20fddcdd..ec223e87 100644 --- a/lib/calendarComponent/views/calendars_view.dart +++ b/lib/calendarComponent/views/calendars_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/last_updated_text.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; @@ -28,16 +29,10 @@ class _CalendarsViewState extends ConsumerState @override void initState() { ref.read(calendarViewModel).fetch(false); + _selectedCalendarTab = 1; super.initState(); } - @override - void didChangeDependencies() { - _selectedCalendarTab = - MediaQuery.orientationOf(context) == Orientation.landscape ? 1 : 0; - super.didChangeDependencies(); - } - @override Widget build(BuildContext context) { super.build(context); diff --git a/lib/calendarComponent/views/homeWidget/calendar_widget_event_view.dart b/lib/calendarComponent/views/homeWidget/calendar_widget_event_view.dart index c18d1101..e8d0545a 100644 --- a/lib/calendarComponent/views/homeWidget/calendar_widget_event_view.dart +++ b/lib/calendarComponent/views/homeWidget/calendar_widget_event_view.dart @@ -73,7 +73,9 @@ class CalendarHomeWidgetEventView extends ConsumerWidget { maxLines: 1, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.labelSmall), - Text(calendarEvent.location, + Text( + calendarEvent.location ?? + context.localizations.unknown, maxLines: 1, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.labelSmall) diff --git a/lib/calendarComponent/views/homeWidget/calendar_widget_view.dart b/lib/calendarComponent/views/homeWidget/calendar_widget_view.dart index 51415fa1..bcad17ed 100644 --- a/lib/calendarComponent/views/homeWidget/calendar_widget_view.dart +++ b/lib/calendarComponent/views/homeWidget/calendar_widget_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/card_with_padding.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; diff --git a/lib/departuresComponent/views/departures_details_view.dart b/lib/departuresComponent/views/departures_details_view.dart index 4234a160..3140c221 100644 --- a/lib/departuresComponent/views/departures_details_view.dart +++ b/lib/departuresComponent/views/departures_details_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/card_with_padding.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/directions_launcher.dart'; diff --git a/lib/departuresComponent/views/homeWidget/departures_widget_view.dart b/lib/departuresComponent/views/homeWidget/departures_widget_view.dart index 02ac0d6e..d62f4b5d 100644 --- a/lib/departuresComponent/views/homeWidget/departures_widget_view.dart +++ b/lib/departuresComponent/views/homeWidget/departures_widget_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/card_with_padding.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; diff --git a/lib/gradeComponent/views/grades_view.dart b/lib/gradeComponent/views/grades_view.dart index 6e50372d..e740efde 100644 --- a/lib/gradeComponent/views/grades_view.dart +++ b/lib/gradeComponent/views/grades_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/last_updated_text.dart'; import 'package:campus_flutter/base/helpers/padded_divider.dart'; diff --git a/lib/homeComponent/widgetComponent/views/widget_screen.dart b/lib/homeComponent/widgetComponent/views/widget_screen.dart index 97629729..2ed45cf8 100644 --- a/lib/homeComponent/widgetComponent/views/widget_screen.dart +++ b/lib/homeComponent/widgetComponent/views/widget_screen.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/enums/home_widget.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; diff --git a/lib/lectureComponent/views/lecture_details_view.dart b/lib/lectureComponent/views/lecture_details_view.dart index 07023c1b..2f4c861f 100644 --- a/lib/lectureComponent/views/lecture_details_view.dart +++ b/lib/lectureComponent/views/lecture_details_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/last_updated_text.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; diff --git a/lib/lectureComponent/views/lecture_meeting_info_view.dart b/lib/lectureComponent/views/lecture_meeting_info_view.dart index a5ed1426..0965dc88 100644 --- a/lib/lectureComponent/views/lecture_meeting_info_view.dart +++ b/lib/lectureComponent/views/lecture_meeting_info_view.dart @@ -21,7 +21,8 @@ class LectureMeetingInfoView extends ConsumerWidget { information: ref.read(viewModel).event!.timeDatePeriod(context), iconData: Icons.hourglass_top), BasicLectureInfoRowView( - information: ref.read(viewModel).event!.location, + information: ref.read(viewModel).event!.location ?? + context.localizations.unknown, iconData: Icons.location_on, trailingWidget: IconButton( onPressed: () => Navigator.push( diff --git a/lib/lectureComponent/views/lectures_view.dart b/lib/lectureComponent/views/lectures_view.dart index e59b741d..50f9d395 100644 --- a/lib/lectureComponent/views/lectures_view.dart +++ b/lib/lectureComponent/views/lectures_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/last_updated_text.dart'; import 'package:campus_flutter/base/helpers/padded_divider.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; diff --git a/lib/loginComponent/views/confirm_view.dart b/lib/loginComponent/views/confirm_view.dart index 020f9409..8179cdff 100644 --- a/lib/loginComponent/views/confirm_view.dart +++ b/lib/loginComponent/views/confirm_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'dart:io'; import 'package:campus_flutter/base/helpers/icon_text.dart'; diff --git a/lib/loginComponent/views/login_view.dart b/lib/loginComponent/views/login_view.dart index e26afa10..67fdc431 100644 --- a/lib/loginComponent/views/login_view.dart +++ b/lib/loginComponent/views/login_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; import 'package:campus_flutter/providers_get_it.dart'; import 'package:flutter/foundation.dart'; diff --git a/lib/movieComponent/views/homeWidget/movie_card_view.dart b/lib/movieComponent/views/homeWidget/movie_card_view.dart index 670e312c..a1ab4de6 100644 --- a/lib/movieComponent/views/homeWidget/movie_card_view.dart +++ b/lib/movieComponent/views/homeWidget/movie_card_view.dart @@ -30,7 +30,7 @@ class MovieCardView extends ConsumerWidget { top: Radius.circular(10)), child: CachedNetworkImage( imageUrl: movie.coverUrl.toString(), - fit: BoxFit.fitWidth, + fit: BoxFit.fill, fadeOutDuration: Duration.zero, fadeInDuration: Duration.zero, placeholder: (context, string) => Image.asset( diff --git a/lib/movieComponent/views/homeWidget/movies_widget_view.dart b/lib/movieComponent/views/homeWidget/movies_widget_view.dart index 116a8f8c..702e8c0f 100644 --- a/lib/movieComponent/views/homeWidget/movies_widget_view.dart +++ b/lib/movieComponent/views/homeWidget/movies_widget_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/horizontal_slider.dart'; import 'package:campus_flutter/base/networking/apis/tumdev/campus_backend.pbgrpc.dart'; diff --git a/lib/navigaTumComponent/views/navigatum_room_view.dart b/lib/navigaTumComponent/views/navigatum_room_view.dart index fe0aea99..601bc300 100644 --- a/lib/navigaTumComponent/views/navigatum_room_view.dart +++ b/lib/navigaTumComponent/views/navigatum_room_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; import 'package:campus_flutter/navigaTumComponent/model/navigatum_navigation_details.dart'; diff --git a/lib/newsComponent/views/homeWidget/news_widget_view.dart b/lib/newsComponent/views/homeWidget/news_widget_view.dart index 483d5098..61575040 100644 --- a/lib/newsComponent/views/homeWidget/news_widget_view.dart +++ b/lib/newsComponent/views/homeWidget/news_widget_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/horizontal_slider.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; diff --git a/lib/personDetailedComponent/views/person_details_view.dart b/lib/personDetailedComponent/views/person_details_view.dart index 11063bf4..2f589045 100644 --- a/lib/personDetailedComponent/views/person_details_view.dart +++ b/lib/personDetailedComponent/views/person_details_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/extensions/base_64_decode_image_data.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/url_launcher.dart'; diff --git a/lib/placesComponent/services/mealplan_service.dart b/lib/placesComponent/services/mealplan_service.dart index 157986ab..ff3f323f 100644 --- a/lib/placesComponent/services/mealplan_service.dart +++ b/lib/placesComponent/services/mealplan_service.dart @@ -1,5 +1,3 @@ -import 'dart:developer'; - import 'package:campus_flutter/base/extensions/date_time_week_number.dart'; import 'package:campus_flutter/base/networking/apis/eatApi/eat_api.dart'; import 'package:campus_flutter/base/networking/apis/eatApi/eat_api_service.dart'; diff --git a/lib/placesComponent/views/cafeterias/cafeteria_view.dart b/lib/placesComponent/views/cafeterias/cafeteria_view.dart index 47146bcb..061fb303 100644 --- a/lib/placesComponent/views/cafeterias/cafeteria_view.dart +++ b/lib/placesComponent/views/cafeterias/cafeteria_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/info_row.dart'; import 'package:campus_flutter/base/helpers/padded_divider.dart'; diff --git a/lib/placesComponent/views/cafeterias/cafeterias_view.dart b/lib/placesComponent/views/cafeterias/cafeterias_view.dart index c462935a..52436111 100644 --- a/lib/placesComponent/views/cafeterias/cafeterias_view.dart +++ b/lib/placesComponent/views/cafeterias/cafeterias_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/padded_divider.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; diff --git a/lib/placesComponent/views/homeWidget/cafeteria_widget_view.dart b/lib/placesComponent/views/homeWidget/cafeteria_widget_view.dart index 1d8e370d..f1b166e1 100644 --- a/lib/placesComponent/views/homeWidget/cafeteria_widget_view.dart +++ b/lib/placesComponent/views/homeWidget/cafeteria_widget_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/card_with_padding.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/horizontal_slider.dart'; diff --git a/lib/placesComponent/views/homeWidget/study_room_widget_view.dart b/lib/placesComponent/views/homeWidget/study_room_widget_view.dart index a3444875..867a11fc 100644 --- a/lib/placesComponent/views/homeWidget/study_room_widget_view.dart +++ b/lib/placesComponent/views/homeWidget/study_room_widget_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; import 'package:campus_flutter/homeComponent/widgetComponent/views/widget_frame_view.dart'; diff --git a/lib/placesComponent/views/places_screen.dart b/lib/placesComponent/views/places_screen.dart index faf3dc20..9a472d6c 100644 --- a/lib/placesComponent/views/places_screen.dart +++ b/lib/placesComponent/views/places_screen.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; import 'package:campus_flutter/placesComponent/views/places_view.dart'; diff --git a/lib/placesComponent/views/studyGroups/study_room_group_view.dart b/lib/placesComponent/views/studyGroups/study_room_group_view.dart index a29e9a67..87abcad5 100644 --- a/lib/placesComponent/views/studyGroups/study_room_group_view.dart +++ b/lib/placesComponent/views/studyGroups/study_room_group_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/last_updated_text.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; diff --git a/lib/placesComponent/views/studyGroups/study_rooms_view.dart b/lib/placesComponent/views/studyGroups/study_rooms_view.dart index bd3f43a2..a9056da0 100644 --- a/lib/placesComponent/views/studyGroups/study_rooms_view.dart +++ b/lib/placesComponent/views/studyGroups/study_rooms_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/padded_divider.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; diff --git a/lib/searchComponent/views/appWideSearch/resultViews/calendar_search_result_view.dart b/lib/searchComponent/views/appWideSearch/resultViews/calendar_search_result_view.dart index e85c8308..46a08621 100644 --- a/lib/searchComponent/views/appWideSearch/resultViews/calendar_search_result_view.dart +++ b/lib/searchComponent/views/appWideSearch/resultViews/calendar_search_result_view.dart @@ -5,6 +5,7 @@ import 'package:campus_flutter/providers_get_it.dart'; import 'package:campus_flutter/base/enums/search_category.dart'; import 'package:campus_flutter/searchComponent/viewmodels/searchableViewModels/calendar_search_viewmodel.dart'; import 'package:campus_flutter/searchComponent/views/appWideSearch/search_result_card_view.dart'; +import 'package:campus_flutter/theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -30,7 +31,8 @@ class CalendarSearchResultView extends ConsumerWidget { ), IconText( iconData: Icons.location_pin, - label: calendarEvent.location, + label: + calendarEvent.location ?? context.localizations.unknown, style: Theme.of(context).textTheme.bodySmall?.copyWith( color: Theme.of(context).colorScheme.secondary), iconColor: Theme.of(context).primaryColor, diff --git a/lib/searchComponent/views/appWideSearch/search_result_card_view.dart b/lib/searchComponent/views/appWideSearch/search_result_card_view.dart index c52eeb78..7f666e65 100644 --- a/lib/searchComponent/views/appWideSearch/search_result_card_view.dart +++ b/lib/searchComponent/views/appWideSearch/search_result_card_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/helpers/padded_divider.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; diff --git a/lib/searchComponent/views/personRoomSearch/search_view.dart b/lib/searchComponent/views/personRoomSearch/search_view.dart index 631b18b5..f78748bd 100644 --- a/lib/searchComponent/views/personRoomSearch/search_view.dart +++ b/lib/searchComponent/views/personRoomSearch/search_view.dart @@ -1,3 +1,4 @@ +import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/helpers/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/views/error_handling_view.dart'; import 'package:campus_flutter/base/views/seperated_list.dart'; diff --git a/lib/theme.dart b/lib/theme.dart index c0b8240d..74f03626 100644 --- a/lib/theme.dart +++ b/lib/theme.dart @@ -188,6 +188,11 @@ ThemeData lightTheme(BuildContext context) { side: const MaterialStatePropertyAll( BorderSide(color: _lightGray, width: 0.5), ), + shape: MaterialStatePropertyAll( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + ), + ), ), ), ); @@ -359,6 +364,11 @@ ThemeData darkTheme(BuildContext context) { side: const MaterialStatePropertyAll( BorderSide(color: _darkGray, width: 0.5), ), + shape: MaterialStatePropertyAll( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + ), + ), ), ), );