diff --git a/analysis_options.yaml b/analysis_options.yaml index ba2dd286..72acdd59 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -3,10 +3,6 @@ # For apps, use the default set include: package:lint/analysis_options.yaml -# Packages, that may be distributed (i.e. via pub.dev) should use the package -# version, resulting in a better pub score. -# include: package:lint/analysis_options_package.yaml - # You might want to exclude auto-generated files from dart analysis analyzer: exclude: @@ -16,12 +12,20 @@ analyzer: # can be found at https://dart-lang.github.io/linter/lints/options/options.html linter: rules: - # Util classes are awesome! - # avoid_classes_with_only_static_members: false - - # Make constructors the first thing in every class - # sort_constructors_first: true - - # Choose wisely, but you don't have to - # prefer_double_quotes: true - # prefer_single_quotes: true \ No newline at end of file + avoid_classes_with_only_static_members: false + avoid_print: false + constant_identifier_names: false + avoid_positional_boolean_parameters: false + join_return_with_assignment: false + type_annotate_public_apis: false + avoid_dynamic_calls: false + no_leading_underscores_for_local_identifiers: false + use_setters_to_change_properties: false + empty_catches: false + use_build_context_synchronously: false + parameter_assignments: false + avoid_catching_errors: false + no_logic_in_create_state: false + noop_primitive_operations: false + leading_newlines_in_multiline_strings: false + depend_on_referenced_packages: false diff --git a/lib/common/ui/colors.dart b/lib/common/ui/colors.dart index 1cb735da..7bb03bc3 100644 --- a/lib/common/ui/colors.dart +++ b/lib/common/ui/colors.dart @@ -92,10 +92,12 @@ class ColorPalettes { return themeData.copyWith( snackBarTheme: themeData.snackBarTheme.copyWith( - backgroundColor: isDark ? const Color(0xff363635) : const Color(0xfffafafa), + backgroundColor: + isDark ? const Color(0xff363635) : const Color(0xfffafafa), contentTextStyle: themeData.textTheme.bodyText1.copyWith( - color: - isDark ? const Color(0xffe4e4e4) : themeData.textTheme.bodyText1.color, + color: isDark + ? const Color(0xffe4e4e4) + : themeData.textTheme.bodyText1.color, ), ), textButtonTheme: TextButtonThemeData( diff --git a/lib/common/ui/custom_icons_icons.dart b/lib/common/ui/custom_icons_icons.dart index 53e6a4d5..7fd4d3c1 100644 --- a/lib/common/ui/custom_icons_icons.dart +++ b/lib/common/ui/custom_icons_icons.dart @@ -24,6 +24,5 @@ class CustomIcons { static const _kFontFam = 'CustomIcons'; - static const IconData logout = - IconData(0xe800, fontFamily: _kFontFam); + static const IconData logout = IconData(0xe800, fontFamily: _kFontFam); } diff --git a/lib/common/util/date_utils.dart b/lib/common/util/date_utils.dart index 127b2f28..b0c81674 100644 --- a/lib/common/util/date_utils.dart +++ b/lib/common/util/date_utils.dart @@ -5,9 +5,7 @@ DateTime toStartOfDay(DateTime dateTime) { } DateTime toStartOfMonth(DateTime dateTime) { - return dateTime == null - ? null - : DateTime(dateTime.year, dateTime.month); + return dateTime == null ? null : DateTime(dateTime.year, dateTime.month); } DateTime tomorrow(DateTime dateTime) { diff --git a/lib/date_management/data/calendar_access.dart b/lib/date_management/data/calendar_access.dart index c0ae4456..a034a41a 100644 --- a/lib/date_management/data/calendar_access.dart +++ b/lib/date_management/data/calendar_access.dart @@ -101,7 +101,8 @@ class CalendarAccess { String _getIdOfExistingEvent(List existingEvents, DateEntry entry) { final existingEvent = existingEvents .where( - (element) => element.title == entry.description && + (element) => + element.title == entry.description && element.start.toUtc().isAtSameMomentAs(entry.start.toUtc()), ) .toList(); diff --git a/lib/date_management/ui/date_management_navigation_entry.dart b/lib/date_management/ui/date_management_navigation_entry.dart index ddc317c6..f9b39568 100644 --- a/lib/date_management/ui/date_management_navigation_entry.dart +++ b/lib/date_management/ui/date_management_navigation_entry.dart @@ -26,9 +26,9 @@ class DateManagementNavigationEntry extends NavigationEntry { @override BaseViewModel initViewModel() { _viewModel ??= DateManagementViewModel( - KiwiContainer().resolve(), - KiwiContainer().resolve(), - ); + KiwiContainer().resolve(), + KiwiContainer().resolve(), + ); return _viewModel; } diff --git a/lib/date_management/ui/date_management_page.dart b/lib/date_management/ui/date_management_page.dart index 657f8c18..3179ed42 100644 --- a/lib/date_management/ui/date_management_page.dart +++ b/lib/date_management/ui/date_management_page.dart @@ -124,13 +124,16 @@ class DateManagementPage extends StatelessWidget { ), // When the date entry has a time of 00:00 don't show it. // It means the date entry is for the whole day - if (isAtMidnight(dateEntry.start)) Container() else Padding( - padding: const EdgeInsets.fromLTRB(0, 4, 0, 0), - child: Text( - DateFormat.Hm(L.of(context).locale.languageCode) - .format(dateEntry.start), - ), - ), + if (isAtMidnight(dateEntry.start)) + Container() + else + Padding( + padding: const EdgeInsets.fromLTRB(0, 4, 0, 0), + child: Text( + DateFormat.Hm(L.of(context).locale.languageCode) + .format(dateEntry.start), + ), + ), ], ), onTap: () { diff --git a/lib/date_management/ui/widgets/date_detail_bottom_sheet.dart b/lib/date_management/ui/widgets/date_detail_bottom_sheet.dart index 53a01054..33c70c32 100644 --- a/lib/date_management/ui/widgets/date_detail_bottom_sheet.dart +++ b/lib/date_management/ui/widgets/date_detail_bottom_sheet.dart @@ -59,10 +59,13 @@ class DateDetailBottomSheet extends StatelessWidget { softWrap: true, style: Theme.of(context).textTheme.subtitle2, ), - if (isAtMidnight(dateEntry.start)) Container() else Text( - time, - softWrap: true, - ), + if (isAtMidnight(dateEntry.start)) + Container() + else + Text( + time, + softWrap: true, + ), ], ), ), diff --git a/lib/dualis/ui/dualis_navigation_entry.dart b/lib/dualis/ui/dualis_navigation_entry.dart index dae61156..76eb9539 100644 --- a/lib/dualis/ui/dualis_navigation_entry.dart +++ b/lib/dualis/ui/dualis_navigation_entry.dart @@ -25,9 +25,9 @@ class DualisNavigationEntry extends NavigationEntry { @override BaseViewModel initViewModel() { _viewModel ??= StudyGradesViewModel( - KiwiContainer().resolve(), - KiwiContainer().resolve(), - ); + KiwiContainer().resolve(), + KiwiContainer().resolve(), + ); return _viewModel; } diff --git a/lib/dualis/ui/widgets/login_form_widget.dart b/lib/dualis/ui/widgets/login_form_widget.dart index 4cccfd4f..bfa1ce13 100644 --- a/lib/dualis/ui/widgets/login_form_widget.dart +++ b/lib/dualis/ui/widgets/login_form_widget.dart @@ -98,10 +98,13 @@ class _LoginFormState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - if (_title != null) Padding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 24), - child: _title, - ) else Container(), + if (_title != null) + Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 24), + child: _title, + ) + else + Container(), TextField( controller: _usernameEditingController, decoration: InputDecoration( diff --git a/lib/native/widget/android_widget_helper.dart b/lib/native/widget/android_widget_helper.dart index ae463f82..ef03b76c 100644 --- a/lib/native/widget/android_widget_helper.dart +++ b/lib/native/widget/android_widget_helper.dart @@ -5,8 +5,7 @@ import 'package:flutter/services.dart'; /// WidgetHelper which calls native code to control the widget on android /// class AndroidWidgetHelper implements WidgetHelper { - static const platform = - MethodChannel('de.bennik2000.dhbwstudentapp/widget'); + static const platform = MethodChannel('de.bennik2000.dhbwstudentapp/widget'); @override Future disableWidget() async { diff --git a/lib/native/widget/ios_widget_helper.dart b/lib/native/widget/ios_widget_helper.dart index dd088d44..4bc02c14 100644 --- a/lib/native/widget/ios_widget_helper.dart +++ b/lib/native/widget/ios_widget_helper.dart @@ -6,8 +6,7 @@ import 'package:flutter_widgetkit/flutter_widgetkit.dart'; /// WidgetHelper which calls native code to control the widget on iOS /// class IOSWidgetHelper implements WidgetHelper { - static const platform = - MethodChannel('de.bennik2000.dhbwstudentapp/widget'); + static const platform = MethodChannel('de.bennik2000.dhbwstudentapp/widget'); @override Future disableWidget() async { diff --git a/lib/schedule/background/calendar_synchronizer.dart b/lib/schedule/background/calendar_synchronizer.dart index d2fd8b0f..a6950e76 100644 --- a/lib/schedule/background/calendar_synchronizer.dart +++ b/lib/schedule/background/calendar_synchronizer.dart @@ -23,17 +23,17 @@ class CalendarSynchronizer { final List listDateEntries = List.empty(growable: true); for (final element in schedule.entries) { - final DateEntry date = DateEntry( - room: element.room, - comment: element.details, - databaseName: 'DHBW', - description: element.title, - year: element.start.year.toString(), - start: element.start, - end: element.end, - ); - listDateEntries.add(date); - } + final DateEntry date = DateEntry( + room: element.room, + comment: element.details, + databaseName: 'DHBW', + description: element.title, + year: element.start.year.toString(), + start: element.start, + end: element.end, + ); + listDateEntries.add(date); + } KiwiContainer().resolve().listDateEntries = listDateEntries; diff --git a/lib/schedule/business/schedule_source_provider.dart b/lib/schedule/business/schedule_source_provider.dart index cad9fc50..11c51962 100644 --- a/lib/schedule/business/schedule_source_provider.dart +++ b/lib/schedule/business/schedule_source_provider.dart @@ -33,7 +33,8 @@ class ScheduleSourceProvider { ScheduleSource get currentScheduleSource => _currentScheduleSource; - final List _onDidChangeScheduleSourceCallbacks = []; + final List _onDidChangeScheduleSourceCallbacks = + []; ScheduleSourceProvider( this._preferencesProvider, diff --git a/lib/schedule/service/rapla/rapla_parsing_utils.dart b/lib/schedule/service/rapla/rapla_parsing_utils.dart index 4a00f0c0..e654f04c 100644 --- a/lib/schedule/service/rapla/rapla_parsing_utils.dart +++ b/lib/schedule/service/rapla/rapla_parsing_utils.dart @@ -200,10 +200,10 @@ class RaplaParsingUtils { resourcesList.add(resource.innerHtml); } - final buffer = StringBuffer(); - buffer.writeAll(resourcesList, ", "); + final buffer = StringBuffer(); + buffer.writeAll(resourcesList, ", "); - return buffer.toString(); + return buffer.toString(); } static String readYearOrThrow(Document document) { diff --git a/lib/schedule/ui/dailyschedule/daily_schedule_page.dart b/lib/schedule/ui/dailyschedule/daily_schedule_page.dart index 3c2cfa8d..168bece8 100644 --- a/lib/schedule/ui/dailyschedule/daily_schedule_page.dart +++ b/lib/schedule/ui/dailyschedule/daily_schedule_page.dart @@ -48,39 +48,41 @@ class _DailySchedulePageState extends State { }, ), ), - if ((viewModel.daySchedule?.entries?.length ?? 0) == 0) Padding( - padding: const EdgeInsets.fromLTRB(0, 32, 0, 0), - child: Column( + if ((viewModel.daySchedule?.entries?.length ?? 0) == 0) + Padding( + padding: const EdgeInsets.fromLTRB(0, 32, 0, 0), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: Container()), - Expanded( - flex: 8, - child: Text( - L.of(context).dailyScheduleNoEntriesToday, - softWrap: true, - textAlign: TextAlign.center, - style: - textStyleDailyScheduleNoEntries(context), - ), - ), - Expanded(child: Container()), - ], - ), - Padding( - padding: const EdgeInsets.fromLTRB(32, 64, 32, 32), - child: Opacity( - opacity: 0.9, - child: Image.asset("assets/empty_state.png"), + Expanded(child: Container()), + Expanded( + flex: 8, + child: Text( + L.of(context).dailyScheduleNoEntriesToday, + softWrap: true, + textAlign: TextAlign.center, + style: textStyleDailyScheduleNoEntries(context), ), - ) + ), + Expanded(child: Container()), ], ), - ) else Column( - children: buildEntryWidgets(), - ) + Padding( + padding: const EdgeInsets.fromLTRB(32, 64, 32, 32), + child: Opacity( + opacity: 0.9, + child: Image.asset("assets/empty_state.png"), + ), + ) + ], + ), + ) + else + Column( + children: buildEntryWidgets(), + ) ], ), ), diff --git a/lib/schedule/ui/weeklyschedule/schedule_entry_detail_bottom_sheet.dart b/lib/schedule/ui/weeklyschedule/schedule_entry_detail_bottom_sheet.dart index 6067b346..a0a8e71b 100644 --- a/lib/schedule/ui/weeklyschedule/schedule_entry_detail_bottom_sheet.dart +++ b/lib/schedule/ui/weeklyschedule/schedule_entry_detail_bottom_sheet.dart @@ -115,18 +115,27 @@ class ScheduleEntryDetailBottomSheet extends StatelessWidget { ], ), ), - if (scheduleEntry.room?.isEmpty ?? true) Container() else Padding( - padding: const EdgeInsets.fromLTRB(0, 8, 0, 0), - child: Text(scheduleEntry.room.replaceAll(",", "\n")), - ), - if (scheduleEntry.details?.isEmpty ?? true) Container() else Padding( - padding: const EdgeInsets.fromLTRB(0, 16, 0, 16), - child: Container( - color: colorSeparator(), - height: 1, - ), - ), - if (scheduleEntry.details?.isEmpty ?? true) Container() else Text(scheduleEntry.details), + if (scheduleEntry.room?.isEmpty ?? true) + Container() + else + Padding( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 0), + child: Text(scheduleEntry.room.replaceAll(",", "\n")), + ), + if (scheduleEntry.details?.isEmpty ?? true) + Container() + else + Padding( + padding: const EdgeInsets.fromLTRB(0, 16, 0, 16), + child: Container( + color: colorSeparator(), + height: 1, + ), + ), + if (scheduleEntry.details?.isEmpty ?? true) + Container() + else + Text(scheduleEntry.details), ], ), ), diff --git a/lib/schedule/ui/weeklyschedule/widgets/schedule_widget.dart b/lib/schedule/ui/weeklyschedule/widgets/schedule_widget.dart index 278a0cd0..6cf185bd 100644 --- a/lib/schedule/ui/weeklyschedule/widgets/schedule_widget.dart +++ b/lib/schedule/ui/weeklyschedule/widgets/schedule_widget.dart @@ -88,7 +88,8 @@ class ScheduleWidget extends StatelessWidget { colorScheduleGridGridLines(context), ), Padding( - padding: const EdgeInsets.fromLTRB(timeLabelsWidth, dayLabelsHeight, 0, 0), + padding: + const EdgeInsets.fromLTRB(timeLabelsWidth, dayLabelsHeight, 0, 0), child: Stack( children: entryWidgets, ), @@ -97,7 +98,8 @@ class ScheduleWidget extends StatelessWidget { children: labelWidgets, ), Padding( - padding: const EdgeInsets.fromLTRB(timeLabelsWidth, dayLabelsHeight, 0, 0), + padding: + const EdgeInsets.fromLTRB(timeLabelsWidth, dayLabelsHeight, 0, 0), child: SchedulePastOverlay( displayStartHour, displayEndHour, diff --git a/lib/ui/banner_widget.dart b/lib/ui/banner_widget.dart index 8fbe49d7..e584da18 100644 --- a/lib/ui/banner_widget.dart +++ b/lib/ui/banner_widget.dart @@ -30,18 +30,21 @@ class BannerWidget extends StatelessWidget { Text( message, ), - if (buttonText != null) Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(0, 12, 0, 0), - child: TextButton( - onPressed: onButtonTap, - child: Text(buttonText), - ), - ), - ], - ) else Container(), + if (buttonText != null) + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(0, 12, 0, 0), + child: TextButton( + onPressed: onButtonTap, + child: Text(buttonText), + ), + ), + ], + ) + else + Container(), ], ), ), diff --git a/lib/ui/onboarding/onboardin_step.dart b/lib/ui/onboarding/onboardin_step.dart index b0a52d11..5edc433f 100644 --- a/lib/ui/onboarding/onboardin_step.dart +++ b/lib/ui/onboarding/onboardin_step.dart @@ -123,8 +123,8 @@ class MannheimOnboardingStep extends OnboardingStep { @override OnboardingStepViewModel viewModel() { _viewModel ??= MannheimViewModel( - KiwiContainer().resolve(), - ); + KiwiContainer().resolve(), + ); return _viewModel; } diff --git a/lib/ui/onboarding/widgets/dualis_login_page.dart b/lib/ui/onboarding/widgets/dualis_login_page.dart index 610dc063..69c53c97 100644 --- a/lib/ui/onboarding/widgets/dualis_login_page.dart +++ b/lib/ui/onboarding/widgets/dualis_login_page.dart @@ -77,28 +77,31 @@ class _DualisLoginCredentialsPageState ) : Container(), ), - if (viewModel.isLoading) const SizedBox( - width: 16, - height: 16, - child: CircularProgressIndicator( - strokeWidth: 1, - ), - ) else viewModel.loginSuccess - ? const Icon( - Icons.check, - color: Colors.green, - ) - : TextButton( - onPressed: () async { - await _testCredentials(viewModel); - }, - child: Text( - L - .of(context) - .onboardingDualisTestButton - .toUpperCase(), - ), + if (viewModel.isLoading) + const SizedBox( + width: 16, + height: 16, + child: CircularProgressIndicator( + strokeWidth: 1, + ), + ) + else + viewModel.loginSuccess + ? const Icon( + Icons.check, + color: Colors.green, + ) + : TextButton( + onPressed: () async { + await _testCredentials(viewModel); + }, + child: Text( + L + .of(context) + .onboardingDualisTestButton + .toUpperCase(), ), + ), ], ), ), diff --git a/lib/ui/onboarding/widgets/onboarding_page_background.dart b/lib/ui/onboarding/widgets/onboarding_page_background.dart index a6c7c099..80bad900 100644 --- a/lib/ui/onboarding/widgets/onboarding_page_background.dart +++ b/lib/ui/onboarding/widgets/onboarding_page_background.dart @@ -96,38 +96,44 @@ class OnboardingPageBackground extends StatelessWidget { ), ), ), - if (PlatformUtil.isPhone()) Align( - alignment: Alignment.bottomCenter, - child: SizedBox( - height: 90, - width: double.infinity, - child: Transform.translate( - offset: Offset(bottomBackground.value, 20), - child: Transform.scale( - scale: 1.5, - child: Image.asset( - background[Theme.of(context).brightness], - ), - ), + if (PlatformUtil.isPhone()) + Align( + alignment: Alignment.bottomCenter, + child: SizedBox( + height: 90, + width: double.infinity, + child: Transform.translate( + offset: Offset(bottomBackground.value, 20), + child: Transform.scale( + scale: 1.5, + child: Image.asset( + background[Theme.of(context).brightness], ), ), - ) else Container(), - if (PlatformUtil.isPhone()) Align( - alignment: Alignment.bottomCenter, - child: SizedBox( - height: 90, - width: double.infinity, - child: Transform.translate( - offset: Offset(bottomForeground.value, 20), - child: Transform.scale( - scale: 1.5, - child: Image.asset( - foreground[Theme.of(context).brightness], - ), - ), + ), + ), + ) + else + Container(), + if (PlatformUtil.isPhone()) + Align( + alignment: Alignment.bottomCenter, + child: SizedBox( + height: 90, + width: double.infinity, + child: Transform.translate( + offset: Offset(bottomForeground.value, 20), + child: Transform.scale( + scale: 1.5, + child: Image.asset( + foreground[Theme.of(context).brightness], ), ), - ) else Container(), + ), + ), + ) + else + Container(), ], ); }