diff --git a/lib/base/networking/api/handler/auth_handler.dart b/lib/base/networking/api/handler/auth_handler.dart index c0565bc..3d14da5 100644 --- a/lib/base/networking/api/handler/auth_handler.dart +++ b/lib/base/networking/api/handler/auth_handler.dart @@ -51,7 +51,8 @@ class AuthHandler { .i('Received HTTP response with status code: ${response.statusCode}'); } catch (e) { _logger.e( - 'Error during basic authentication for user: $username, Error: $e',); + 'Error during basic authentication for user: $username, Error: $e', + ); throw AppError.userError(); } try { diff --git a/lib/main.dart b/lib/main.dart index 952a937..22421af 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -41,7 +41,6 @@ class App extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final userState = ref.watch(userViewModelProvider); bool isLoggedIn = ref.watch(userViewModelProvider).user != null; diff --git a/lib/providers.dart b/lib/providers.dart index baecf02..63fd960 100644 --- a/lib/providers.dart +++ b/lib/providers.dart @@ -89,4 +89,3 @@ final playbackSpeedsProvider = StateProvider>((ref) { final connectivityProvider = StreamProvider((ref) { return Connectivity().onConnectivityChanged; }); - diff --git a/lib/view_models/chat_view_model.dart b/lib/view_models/chat_view_model.dart index fe5f0fe..0d2c63a 100644 --- a/lib/view_models/chat_view_model.dart +++ b/lib/view_models/chat_view_model.dart @@ -18,7 +18,10 @@ class ChatViewModel extends StateNotifier { final messages = await ChatHandlers(_grpcHandler).getChatMessages(streamId); state = state.copyWith( - messages: messages, isLoading: false, accessDenied: false,); + messages: messages, + isLoading: false, + accessDenied: false, + ); } catch (e) { state = state.copyWith( error: e as AppError, @@ -38,10 +41,15 @@ class ChatViewModel extends StateNotifier { final messages = await ChatHandlers(_grpcHandler).getChatMessages(streamId); final combinedMessages = List.from(state.messages ?? []) - ..addAll(messages - .where((newMessage) => !state.messages!.contains(newMessage)),); + ..addAll( + messages + .where((newMessage) => !state.messages!.contains(newMessage)), + ); state = state.copyWith( - messages: combinedMessages, isLoading: false, accessDenied: false,); + messages: combinedMessages, + isLoading: false, + accessDenied: false, + ); } catch (e) { state = state.copyWith( error: e as AppError, diff --git a/lib/view_models/download_view_model.dart b/lib/view_models/download_view_model.dart index 3228a4f..999682c 100644 --- a/lib/view_models/download_view_model.dart +++ b/lib/view_models/download_view_model.dart @@ -43,8 +43,12 @@ class DownloadViewModel extends StateNotifier { } } - Future downloadVideo(String videoUrl, Stream stream, - String streamName, String streamDate,) async { + Future downloadVideo( + String videoUrl, + Stream stream, + String streamName, + String streamDate, + ) async { try { final directory = await getApplicationDocumentsDirectory(); final filePath = @@ -60,10 +64,12 @@ class DownloadViewModel extends StateNotifier { final videoDetailsMap = { 'filePath': filePath, 'name': streamName, - 'duration': Tools.formatDuration(stream.end - .toDateTime() - .difference(stream.start.toDateTime()) - .inMinutes,), + 'duration': Tools.formatDuration( + stream.end + .toDateTime() + .difference(stream.start.toDateTime()) + .inMinutes, + ), 'description': stream.description, 'date': streamDate, }; diff --git a/lib/views/chat_view/chat_view_state.dart b/lib/views/chat_view/chat_view_state.dart index b4eeb75..91479e8 100644 --- a/lib/views/chat_view/chat_view_state.dart +++ b/lib/views/chat_view/chat_view_state.dart @@ -62,7 +62,8 @@ class ChatViewState extends ConsumerState { ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text( - 'You are sending messages too fast. Please wait a 60 seconds.',), + 'You are sending messages too fast. Please wait a 60 seconds.', + ), ), ); }); diff --git a/lib/views/chat_view/poll_view_state.dart b/lib/views/chat_view/poll_view_state.dart index 203d993..a254150 100644 --- a/lib/views/chat_view/poll_view_state.dart +++ b/lib/views/chat_view/poll_view_state.dart @@ -264,7 +264,8 @@ class PollViewState extends ConsumerState { return Padding( padding: const EdgeInsets.all( - 8.0,), // Consistent padding with the rest of the layout + 8.0, + ), // Consistent padding with the rest of the layout child: ElevatedButton( onPressed: selectedOptions.containsKey(poll.id) ? () { diff --git a/lib/views/chat_view/suggested_streams_list.dart b/lib/views/chat_view/suggested_streams_list.dart index 176ad95..4acc79c 100644 --- a/lib/views/chat_view/suggested_streams_list.dart +++ b/lib/views/chat_view/suggested_streams_list.dart @@ -21,9 +21,11 @@ class SuggestedStreamsWidget extends StatelessWidget { final stream = suggestedStreams[index]; return ListTile( leading: const Icon(Icons.play_circle_outline), - title: Text(stream.name != '' - ? stream.name - : 'Lecture: ${DateFormat('EEEE. dd', Localizations.localeOf(context).toString()).format(stream.start.toDateTime())}',), + title: Text( + stream.name != '' + ? stream.name + : 'Lecture: ${DateFormat('EEEE. dd', Localizations.localeOf(context).toString()).format(stream.start.toDateTime())}', + ), subtitle: Text( DateFormat('dd MMMM yyyy').format(stream.start.toDateTime()), ), diff --git a/lib/views/course_view/components/course_card.dart b/lib/views/course_view/components/course_card.dart index f7fdb68..543758b 100644 --- a/lib/views/course_view/components/course_card.dart +++ b/lib/views/course_view/components/course_card.dart @@ -171,8 +171,11 @@ class CourseCard extends StatelessWidget { child: _buildCourseTitle(themeData.textTheme), ), if (isPinned) - Icon(Icons.push_pin, - color: themeData.primaryColor, size: 16,), + Icon( + Icons.push_pin, + color: themeData.primaryColor, + size: 16, + ), ], ), ), diff --git a/lib/views/course_view/components/small_stream_card.dart b/lib/views/course_view/components/small_stream_card.dart index 3b8b0c0..be5342b 100644 --- a/lib/views/course_view/components/small_stream_card.dart +++ b/lib/views/course_view/components/small_stream_card.dart @@ -77,14 +77,20 @@ class SmallStreamCard extends StatelessWidget { } Widget _buildStreamCard( - BuildContext context, ThemeData themeData, double cardWidth,) { + BuildContext context, + ThemeData themeData, + double cardWidth, + ) { return (isDownloaded != null && showDeleteConfirmationDialog != null) ? _buildDownloadedCard(context, themeData, cardWidth) : _buildLiveCard(themeData, cardWidth); } Widget _buildDownloadedCard( - BuildContext context, ThemeData themeData, double cardWidth,) { + BuildContext context, + ThemeData themeData, + double cardWidth, + ) { return Slidable( key: Key(courseId.toString()), closeOnScroll: true, diff --git a/lib/views/course_view/components/stream_card.dart b/lib/views/course_view/components/stream_card.dart index 522a3a8..91cd5fa 100644 --- a/lib/views/course_view/components/stream_card.dart +++ b/lib/views/course_view/components/stream_card.dart @@ -195,10 +195,12 @@ class StreamCardState extends ConsumerState { ), padding: const EdgeInsets.all(5), child: Text( - Tools.formatDuration(widget.stream.end - .toDateTime() - .difference(widget.stream.start.toDateTime()) - .inMinutes,), + Tools.formatDuration( + widget.stream.end + .toDateTime() + .difference(widget.stream.start.toDateTime()) + .inMinutes, + ), style: themeData.textTheme.labelSmall?.copyWith( fontSize: 12, color: Colors.white, diff --git a/lib/views/course_view/downloaded_courses_view/download_content_view.dart b/lib/views/course_view/downloaded_courses_view/download_content_view.dart index e794ca9..a039361 100644 --- a/lib/views/course_view/downloaded_courses_view/download_content_view.dart +++ b/lib/views/course_view/downloaded_courses_view/download_content_view.dart @@ -47,8 +47,9 @@ class DownloadCoursesContentView extends ConsumerWidget { child: Center( child: Padding( padding: const EdgeInsets.symmetric(vertical: 295.0), - child: Text(AppLocalizations.of(context)! - .no_downloaded_courses,), + child: Text( + AppLocalizations.of(context)!.no_downloaded_courses, + ), ), ), ), diff --git a/lib/views/notifications_view/notifications_screen_view.dart b/lib/views/notifications_view/notifications_screen_view.dart index 6594cf3..421458b 100644 --- a/lib/views/notifications_view/notifications_screen_view.dart +++ b/lib/views/notifications_view/notifications_screen_view.dart @@ -41,14 +41,17 @@ class NotificationsScreen extends ConsumerWidget { scrollDirection: Axis.vertical, children: [ _buildSectionHeader( - AppLocalizations.of(context)!.banner_notification,), + AppLocalizations.of(context)!.banner_notification, + ), for (var alert in bannerAlerts) _buildBannerAlert(alert), _buildSectionHeader( - AppLocalizations.of(context)!.feature_notifications,), + AppLocalizations.of(context)!.feature_notifications, + ), for (var notification in featureNotifications) _buildFeatureNotification(notification), _buildSectionHeader( - AppLocalizations.of(context)!.recent_uploads,), + AppLocalizations.of(context)!.recent_uploads, + ), for (var notification in pushNotifications) _buildPushNotification(notification), ], @@ -76,8 +79,10 @@ class NotificationsScreen extends ConsumerWidget { children: [ Expanded( child: Center( - child: Text(AppLocalizations.of(context)! - .no_notifications_found,),), + child: Text( + AppLocalizations.of(context)!.no_notifications_found, + ), + ), ), ], ), diff --git a/lib/views/on_boarding_view/welcome_screen_view.dart b/lib/views/on_boarding_view/welcome_screen_view.dart index ae4abf0..ee6b83f 100644 --- a/lib/views/on_boarding_view/welcome_screen_view.dart +++ b/lib/views/on_boarding_view/welcome_screen_view.dart @@ -21,31 +21,29 @@ class WelcomeScreen extends ConsumerWidget { final connectivityStatus = ref.watch(connectivityProvider); Logger().i(connectivityStatus.toString()); return connectivityStatus.when( - data: (result) { - // If there's no connectivity, navigate or replace the current view. - if (result == ConnectivityResult.none) { - WidgetsBinding.instance.addPostFrameCallback((_) { - - if (ModalRoute.of(context)?.settings.name != '/downloads') { - Navigator.of(context).pushReplacementNamed('/downloads'); - } - }); - } - return _buildMainLayout(context, ref); - }, - loading: () => const Center(child: CircularProgressIndicator()), - error: (error, stackTrace) { - return Center( - child: Text( - AppLocalizations.of(context)!.error_occurred, - style: const TextStyle(color: Colors.red), - ), - ); - }, + data: (result) { + // If there's no connectivity, navigate or replace the current view. + if (result == ConnectivityResult.none) { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (ModalRoute.of(context)?.settings.name != '/downloads') { + Navigator.of(context).pushReplacementNamed('/downloads'); + } + }); + } + return _buildMainLayout(context, ref); + }, + loading: () => const Center(child: CircularProgressIndicator()), + error: (error, stackTrace) { + return Center( + child: Text( + AppLocalizations.of(context)!.error_occurred, + style: const TextStyle(color: Colors.red), + ), + ); + }, ); } - Widget _buildMainLayout(BuildContext context, WidgetRef ref) { final screenSize = MediaQuery.of(context).size; final bool isPortrait = @@ -173,8 +171,10 @@ class WelcomeScreen extends ConsumerWidget { valueColor: AlwaysStoppedAnimation(Colors.white), ), ) - : Text(AppLocalizations.of(context)!.tum_login, - style: const TextStyle(fontSize: 18),), + : Text( + AppLocalizations.of(context)!.tum_login, + style: const TextStyle(fontSize: 18), + ), onPressed: () => handleSSOLogin(context, ref), ); } @@ -190,8 +190,10 @@ class WelcomeScreen extends ConsumerWidget { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)), ), - child: Text(AppLocalizations.of(context)!.continue_without, - style: const TextStyle(fontSize: 18),), + child: Text( + AppLocalizations.of(context)!.continue_without, + style: const TextStyle(fontSize: 18), + ), onPressed: () { Navigator.pushNamed(context, '/publiccourses'); }, diff --git a/lib/views/settings_view/edit_profile_screen_view.dart b/lib/views/settings_view/edit_profile_screen_view.dart index de2e6a0..c792be8 100644 --- a/lib/views/settings_view/edit_profile_screen_view.dart +++ b/lib/views/settings_view/edit_profile_screen_view.dart @@ -152,9 +152,11 @@ class EditProfileScreenState extends ConsumerState { return AlertDialog( backgroundColor: Theme.of(context).colorScheme.onPrimary, title: const Text("Error"), - content: Text(errorMessage == '3 months' - ? AppLocalizations.of(context)!.name_change_limitation - : errorMessage,), + content: Text( + errorMessage == '3 months' + ? AppLocalizations.of(context)!.name_change_limitation + : errorMessage, + ), actions: [ TextButton( child: const Text("OK"), diff --git a/lib/views/settings_view/settings_screen_view.dart b/lib/views/settings_view/settings_screen_view.dart index 9abaf9c..4c26c69 100644 --- a/lib/views/settings_view/settings_screen_view.dart +++ b/lib/views/settings_view/settings_screen_view.dart @@ -48,7 +48,8 @@ class _SettingsScreenState extends ConsumerState { _buildProfileTile(userState), const Divider(), _buildSectionTitle( - AppLocalizations.of(context)!.account_settings,), + AppLocalizations.of(context)!.account_settings, + ), _buildEditableListTile(AppLocalizations.of(context)!.edit_profile, () async { bool isAuthenticated = @@ -90,7 +91,9 @@ class _SettingsScreenState extends ConsumerState { const Divider(), _buildSectionTitle(AppLocalizations.of(context)!.more), _buildNavigableListTile( - AppLocalizations.of(context)!.about_us, "",), + AppLocalizations.of(context)!.about_us, + "", + ), _buildNavigableListTile( AppLocalizations.of(context)!.privacy_policy, "https://live.rbg.tum.de/privacy", diff --git a/lib/views/video_view/offline_video_player/offline_video_player.dart b/lib/views/video_view/offline_video_player/offline_video_player.dart index 4af969e..4684959 100644 --- a/lib/views/video_view/offline_video_player/offline_video_player.dart +++ b/lib/views/video_view/offline_video_player/offline_video_player.dart @@ -79,7 +79,8 @@ class OfflineVideoPlayerPageState // Initialize the controller manager. void _initializeControllerManager() { _controllerManager = OfflineVideoPlayerControllerManager( - localPath: widget.videoDetails.filePath,); + localPath: widget.videoDetails.filePath, + ); } // Initialize the video player and seek to the last progress. diff --git a/lib/views/video_view/utils/download_service.dart b/lib/views/video_view/utils/download_service.dart index 2dfbca5..0e5886d 100644 --- a/lib/views/video_view/utils/download_service.dart +++ b/lib/views/video_view/utils/download_service.dart @@ -29,7 +29,11 @@ class DownloadService { }); Future downloadVideo( - Stream stream, String type, String streamName, String streamDate,) async { + Stream stream, + String type, + String streamName, + String streamDate, + ) async { bool canDownload = await _handleDownloadConnectivity(stream, type); if (!canDownload) return; @@ -54,9 +58,9 @@ class DownloadService { .downloadVideo(downloadUrl, stream, streamName, streamDate) .then((localPath) { if (!isWidgetMounted()) return; - onShowSnackBar(localPath.isNotEmpty - ? downloadCompletedMessage - : downloadFailedMessage,); + onShowSnackBar( + localPath.isNotEmpty ? downloadCompletedMessage : downloadFailedMessage, + ); }); }