diff --git a/lib/common/appstart/background_initialize.dart b/lib/common/appstart/background_initialize.dart index 169b6196..6a3c4adf 100644 --- a/lib/common/appstart/background_initialize.dart +++ b/lib/common/appstart/background_initialize.dart @@ -9,7 +9,7 @@ import 'package:kiwi/kiwi.dart'; class BackgroundInitialize { Future setupBackgroundScheduling() async { - var scheduler; + WorkSchedulerService scheduler; if (Platform.isAndroid) { scheduler = BackgroundWorkScheduler(); } else { diff --git a/lib/common/background/background_work_scheduler.dart b/lib/common/background/background_work_scheduler.dart index fb085800..602ffea7 100644 --- a/lib/common/background/background_work_scheduler.dart +++ b/lib/common/background/background_work_scheduler.dart @@ -5,12 +5,13 @@ import 'package:kiwi/kiwi.dart'; import 'package:workmanager/workmanager.dart'; class BackgroundWorkScheduler extends WorkSchedulerService { - Map _taskCallbacks = {}; + final Map _taskCallbacks = {}; BackgroundWorkScheduler() { _setupBackgroundScheduling(); } + @override Future scheduleOneShotTaskIn( Duration delay, String id, String name) async { print( @@ -25,6 +26,7 @@ class BackgroundWorkScheduler extends WorkSchedulerService { ); } + @override Future scheduleOneShotTaskAt( DateTime date, String id, @@ -33,11 +35,13 @@ class BackgroundWorkScheduler extends WorkSchedulerService { await scheduleOneShotTaskIn(date.difference(DateTime.now()), id, name); } + @override Future cancelTask(String id) async { await Workmanager.cancelByUniqueName(id); print("Cancelled task $id"); } + @override Future schedulePeriodic( Duration delay, String id, [ @@ -60,10 +64,12 @@ class BackgroundWorkScheduler extends WorkSchedulerService { ); } + @override void registerTask(TaskCallback task) { _taskCallbacks[task.getName()] = task; } + @override Future executeTask(String id) async { await _taskCallbacks[id]?.run(); } diff --git a/lib/common/background/void_background_work_scheduler.dart b/lib/common/background/void_background_work_scheduler.dart index 0e22d69a..6f1ee414 100644 --- a/lib/common/background/void_background_work_scheduler.dart +++ b/lib/common/background/void_background_work_scheduler.dart @@ -6,6 +6,7 @@ class VoidBackgroundWorkScheduler extends WorkSchedulerService { print("Background scheduling is not available!"); } + @override Future scheduleOneShotTaskIn(Duration delay, String id, String name) { print( "Did not schedule one shot task: $id. With a delay of ${delay.inMinutes} minutes.", @@ -14,6 +15,7 @@ class VoidBackgroundWorkScheduler extends WorkSchedulerService { return Future.value(); } + @override Future scheduleOneShotTaskAt( DateTime date, String id, @@ -22,12 +24,14 @@ class VoidBackgroundWorkScheduler extends WorkSchedulerService { await scheduleOneShotTaskIn(date.difference(DateTime.now()), id, name); } + @override Future cancelTask(String id) { print("Cancelled task $id"); return Future.value(); } + @override Future schedulePeriodic( Duration delay, String id, [ @@ -40,8 +44,10 @@ class VoidBackgroundWorkScheduler extends WorkSchedulerService { return Future.value(); } + @override void registerTask(TaskCallback task) {} + @override Future executeTask(String id) { return Future.value(); } diff --git a/lib/common/data/database_access.dart b/lib/common/data/database_access.dart index 9cb431e5..9eec93c1 100644 --- a/lib/common/data/database_access.dart +++ b/lib/common/data/database_access.dart @@ -6,10 +6,10 @@ import 'package:path_provider/path_provider.dart'; import 'package:sqflite/sqflite.dart'; class DatabaseAccess { - static final _databaseName = "Database.db"; + static const String _databaseName = "Database.db"; static Database _databaseInstance; - static final String idColumnName = "id"; + static const String idColumnName = "id"; Future get _database async { if (_databaseInstance != null) return _databaseInstance; @@ -18,9 +18,10 @@ class DatabaseAccess { return _databaseInstance; } - _initDatabase() async { - Directory documentsDirectory = await getApplicationDocumentsDirectory(); - String path = join(documentsDirectory.path, _databaseName); + Future _initDatabase() async { + final Directory documentsDirectory = + await getApplicationDocumentsDirectory(); + final String path = join(documentsDirectory.path, _databaseName); return await openDatabase(path, version: SqlScripts.databaseMigrationScripts.length, @@ -28,13 +29,13 @@ class DatabaseAccess { onUpgrade: _onUpgrade); } - Future _onCreate(Database db, int version) async { + Future _onCreate(Database db, int version) async { print("Initializing Database with version: $version"); await _onUpgrade(db, 1, version); } - Future _onUpgrade(Database db, int oldVersion, int newVersion) async { + Future _onUpgrade(Database db, int oldVersion, int newVersion) async { print("Migrating database version: $oldVersion -> $newVersion"); for (var i = oldVersion; i <= newVersion; i++) { diff --git a/lib/common/data/preferences/secure_storage_access.dart b/lib/common/data/preferences/secure_storage_access.dart index 5ffe14fa..ec8e7442 100644 --- a/lib/common/data/preferences/secure_storage_access.dart +++ b/lib/common/data/preferences/secure_storage_access.dart @@ -1,7 +1,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart'; class SecureStorageAccess { - final _secureStorage = new FlutterSecureStorage(); + final _secureStorage = const FlutterSecureStorage(); Future set(String key, String value) async { await _secureStorage.write(key: key, value: value); diff --git a/lib/common/i18n/localizations.dart b/lib/common/i18n/localizations.dart index 453814e7..a555e50d 100644 --- a/lib/common/i18n/localizations.dart +++ b/lib/common/i18n/localizations.dart @@ -310,12 +310,12 @@ class L { return Localizations.of(context, L); } - static Map> _localizedValues = { + static final Map> _localizedValues = { "de": de, "en": en }; - _getValue(String key) { + String _getValue(String key) { return _localizedValues[_language][key] ?? ""; } diff --git a/lib/common/ui/colors.dart b/lib/common/ui/colors.dart index f127c67e..a17ba1de 100644 --- a/lib/common/ui/colors.dart +++ b/lib/common/ui/colors.dart @@ -73,16 +73,16 @@ class ColorPalettes { } static const MaterialColor main = MaterialColor(0xffff061c, { - 050: const Color(0xFFff838e), - 100: const Color(0xFFff6a77), - 200: const Color(0xFFff5160), - 300: const Color(0xFFff3849), - 400: const Color(0xFFff1f33), - 500: const Color(0xffff061c), - 600: const Color(0xFFe60519), - 700: const Color(0xFFcc0516), - 800: const Color(0xFFb30414), - 900: const Color(0xFF990411), + 050: Color(0xFFff838e), + 100: Color(0xFFff6a77), + 200: Color(0xFFff5160), + 300: Color(0xFFff3849), + 400: Color(0xFFff1f33), + 500: Color(0xffff061c), + 600: Color(0xFFe60519), + 700: Color(0xFFcc0516), + 800: Color(0xFFb30414), + 900: Color(0xFF990411), }); static const MaterialColor secondary = MaterialColor(0xFFCECED0, { diff --git a/lib/common/ui/notification_api.dart b/lib/common/ui/notification_api.dart index bb4b02f6..08f12a59 100644 --- a/lib/common/ui/notification_api.dart +++ b/lib/common/ui/notification_api.dart @@ -8,7 +8,7 @@ class NotificationApi { FlutterLocalNotificationsPlugin(); Future initialize() async { - var initializationSettingsAndroid = AndroidInitializationSettings( + var initializationSettingsAndroid = const AndroidInitializationSettings( 'outline_event_note_24', ); @@ -44,7 +44,7 @@ class NotificationApi { ticker: 'ticker', ); - var iOSPlatformChannelSpecifics = IOSNotificationDetails(); + var iOSPlatformChannelSpecifics = const IOSNotificationDetails(); var platformChannelSpecifics = NotificationDetails( androidPlatformChannelSpecifics, diff --git a/lib/common/ui/rate_in_store.dart b/lib/common/ui/rate_in_store.dart index 9ab6d61d..fab9a120 100644 --- a/lib/common/ui/rate_in_store.dart +++ b/lib/common/ui/rate_in_store.dart @@ -10,7 +10,8 @@ class RateInStore { RateInStore(this._preferencesProvider); Future showRateInStoreDialogIfNeeded(BuildContext context) async { - var countdown = await _preferencesProvider.getRateInStoreLaunchCountdown(); + final countdown = + await _preferencesProvider.getRateInStoreLaunchCountdown(); if (countdown <= 0) { if (await _preferencesProvider.getDontShowRateNowDialog()) return; @@ -27,15 +28,15 @@ class RateInStore { barrierDismissible: false, builder: (BuildContext context) { return AlertDialog( - buttonPadding: EdgeInsets.all(0), - actionsPadding: EdgeInsets.all(0), - contentPadding: EdgeInsets.all(0), + buttonPadding: const EdgeInsets.all(0), + actionsPadding: const EdgeInsets.all(0), + contentPadding: const EdgeInsets.all(0), title: Text(L.of(context).rateDialogTitle), content: Column( mainAxisSize: MainAxisSize.min, children: [ Padding( - padding: EdgeInsets.all(24), + padding: const EdgeInsets.all(24), child: Text(L.of(context).rateDialogMessage), ), Padding( @@ -52,7 +53,7 @@ class RateInStore { ButtonBar _buildButtonBar(BuildContext context) { return ButtonBar( mainAxisSize: MainAxisSize.max, - buttonPadding: EdgeInsets.fromLTRB(5, 0, 5, 0), + buttonPadding: const EdgeInsets.fromLTRB(5, 0, 5, 0), children: [ FlatButton( child: Text(L.of(context).rateDialogDoNotRateButton.toUpperCase()), diff --git a/lib/common/ui/widgets/error_display.dart b/lib/common/ui/widgets/error_display.dart index 38bd1968..6cefef8f 100644 --- a/lib/common/ui/widgets/error_display.dart +++ b/lib/common/ui/widgets/error_display.dart @@ -34,7 +34,7 @@ class ErrorDisplay extends StatelessWidget { : Container( width: double.infinity, ), - duration: Duration(milliseconds: 300), + duration: const Duration(milliseconds: 300), ), ], ); diff --git a/lib/common/util/cancelable_mutex.dart b/lib/common/util/cancelable_mutex.dart index 8a540688..5335981a 100644 --- a/lib/common/util/cancelable_mutex.dart +++ b/lib/common/util/cancelable_mutex.dart @@ -2,7 +2,7 @@ import 'package:mutex/mutex.dart'; import 'cancellation_token.dart'; class CancelableMutex { - Mutex _mutex = Mutex(); + final Mutex _mutex = Mutex(); CancellationToken _token; CancellationToken get token => _token; diff --git a/lib/date_management/data/calendar_access.dart b/lib/date_management/data/calendar_access.dart index 16300fb4..66fb76e3 100644 --- a/lib/date_management/data/calendar_access.dart +++ b/lib/date_management/data/calendar_access.dart @@ -51,7 +51,7 @@ class CalendarAccess { List dateEntries, Calendar calendar, ) async { - if ((dateEntries ?? []).length == 0) return; + if ((dateEntries ?? []).isEmpty) return; var existingEvents = await _getExistingEventsFromCalendar(dateEntries, calendar); @@ -70,7 +70,7 @@ class CalendarAccess { var isAllDay = isAtMidnight(entry.dateAndTime); var start = entry.dateAndTime; - var end = isAllDay ? start : start.add(Duration(minutes: 30)); + var end = isAllDay ? start : start.add(const Duration(minutes: 30)); await _deviceCalendarPlugin.createOrUpdateEvent(Event( calendar.id, @@ -90,9 +90,9 @@ class CalendarAccess { .where((element) => element.title == entry.description) .toList(); - var id; + String id; - if (existingEvent.length > 0) { + if (existingEvent.isNotEmpty) { id = existingEvent[0].eventId; } return id; diff --git a/lib/date_management/data/date_entry_entity.dart b/lib/date_management/data/date_entry_entity.dart index 8d0ee44f..3c82cc13 100644 --- a/lib/date_management/data/date_entry_entity.dart +++ b/lib/date_management/data/date_entry_entity.dart @@ -14,12 +14,12 @@ class DateEntryEntity extends DatabaseEntity { @override void fromMap(Map map) { - var date; + DateTime date; if (map["date"] != null) { date = DateTime.fromMillisecondsSinceEpoch(map["date"]); } - _dateEntry = new DateEntry( + _dateEntry = DateEntry( comment: map["comment"], dateAndTime: date, description: map["description"], diff --git a/lib/date_management/data/date_entry_repository.dart b/lib/date_management/data/date_entry_repository.dart index 9c975f14..7a4f675b 100644 --- a/lib/date_management/data/date_entry_repository.dart +++ b/lib/date_management/data/date_entry_repository.dart @@ -104,7 +104,7 @@ class DateEntryRepository { for (var row in rows) { dateEntries.add( - new DateEntryEntity.fromMap(row).asDateEntry(), + DateEntryEntity.fromMap(row).asDateEntry(), ); } diff --git a/lib/date_management/service/parsing/all_dates_extract.dart b/lib/date_management/service/parsing/all_dates_extract.dart index 511369a5..3a4e01b4 100644 --- a/lib/date_management/service/parsing/all_dates_extract.dart +++ b/lib/date_management/service/parsing/all_dates_extract.dart @@ -10,7 +10,7 @@ class AllDatesExtract { return _extractAllDates(body, databaseName); } catch (e) { if (e.runtimeType is ParseException) rethrow; - throw new ParseException.withInner(e); + throw ParseException.withInner(e); } } diff --git a/lib/date_management/ui/calendar_export_page.dart b/lib/date_management/ui/calendar_export_page.dart index f58cf0e1..b120e11a 100644 --- a/lib/date_management/ui/calendar_export_page.dart +++ b/lib/date_management/ui/calendar_export_page.dart @@ -60,7 +60,7 @@ class _CalendarExportPageState extends State { L.of(context).dateManagementExportToCalendarDescription)), ), _buildCalendarList(), - Divider( + const Divider( height: 1, ), _buildExportButton() @@ -106,7 +106,7 @@ class _CalendarExportPageState extends State { Container( width: 24, height: 24, - decoration: new BoxDecoration( + decoration: BoxDecoration( shape: BoxShape.circle, color: isSelected ? Color(calendar.color) : Colors.transparent, border: Border.all( @@ -143,8 +143,8 @@ class _CalendarExportPageState extends State { builder: (BuildContext context, CalendarExportViewModel viewModel, _) => viewModel.isExporting - ? Padding( - padding: const EdgeInsets.all(8.0), + ? const Padding( + padding: EdgeInsets.all(8.0), child: SizedBox( height: 32, width: 32, diff --git a/lib/date_management/ui/date_management_page.dart b/lib/date_management/ui/date_management_page.dart index 37ab8f35..815271cf 100644 --- a/lib/date_management/ui/date_management_page.dart +++ b/lib/date_management/ui/date_management_page.dart @@ -25,11 +25,11 @@ class DateManagementPage extends StatelessWidget { DateFilterOptions(viewModel: viewModel), Stack( children: [ - Divider(), + const Divider(), AnimatedSwitcher( - duration: Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), child: viewModel.isLoading - ? LinearProgressIndicator() + ? const LinearProgressIndicator() : Container()), ], ), @@ -52,7 +52,7 @@ class DateManagementPage extends StatelessWidget { _, ) => AnimatedSwitcher( - duration: Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), child: Column( key: ValueKey( viewModel?.dateSearchParameters?.toString() ?? ""), @@ -146,7 +146,7 @@ class DateManagementPage extends StatelessWidget { builder: (context) => DateDetailBottomSheet( dateEntry: entry, ), - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(top: Radius.circular(12.0)), ), ); @@ -154,7 +154,7 @@ class DateManagementPage extends StatelessWidget { Widget buildErrorDisplay(BuildContext context) { return PropertyChangeConsumer( - properties: [ + properties: const [ "updateFailed", ], builder: (BuildContext context, DateManagementViewModel model, diff --git a/lib/date_management/ui/viewmodels/date_management_view_model.dart b/lib/date_management/ui/viewmodels/date_management_view_model.dart index d2387734..2c4b1765 100644 --- a/lib/date_management/ui/viewmodels/date_management_view_model.dart +++ b/lib/date_management/ui/viewmodels/date_management_view_model.dart @@ -198,7 +198,7 @@ class DateManagementViewModel extends BaseViewModel { } _errorResetTimer = Timer( - Duration(seconds: 5), + const Duration(seconds: 5), () { _updateFailed = false; notifyListeners("updateFailed"); 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 d3dbffb1..48dfdaad 100644 --- a/lib/date_management/ui/widgets/date_detail_bottom_sheet.dart +++ b/lib/date_management/ui/widgets/date_detail_bottom_sheet.dart @@ -32,10 +32,9 @@ class DateDetailBottomSheet extends StatelessWidget { child: Container( height: 8, width: 30, - decoration: new BoxDecoration( + decoration: BoxDecoration( color: colorSeparator(), - borderRadius: - new BorderRadius.all(const Radius.circular(4))), + borderRadius: const BorderRadius.all(Radius.circular(4))), child: null, ), ), diff --git a/lib/date_management/ui/widgets/date_filter_options.dart b/lib/date_management/ui/widgets/date_filter_options.dart index 9ce30ff6..3d620202 100644 --- a/lib/date_management/ui/widgets/date_filter_options.dart +++ b/lib/date_management/ui/widgets/date_filter_options.dart @@ -25,7 +25,7 @@ class _DateFilterOptionsState extends State { return AnimatedCrossFade( secondChild: _fixAbsorbPointer(_buildExpanded()), firstChild: _fixAbsorbPointer(_buildCollapsed()), - duration: Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), crossFadeState: _isExpanded ? CrossFadeState.showSecond : CrossFadeState.showFirst, ); @@ -37,7 +37,7 @@ class _DateFilterOptionsState extends State { // More details here: https://github.com/flutter/flutter/issues/10168 return Stack( children: [ - Positioned.fill( + const Positioned.fill( child: AbsorbPointer(), ), widget @@ -66,7 +66,7 @@ class _DateFilterOptionsState extends State { height: 36, child: FlatButton( child: Icon(Icons.tune), - padding: EdgeInsets.all(0), + padding: const EdgeInsets.all(0), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, onPressed: () { setState(() { @@ -208,8 +208,8 @@ class _DateFilterOptionsState extends State { minWidth: 36, height: 36, child: FlatButton( - child: Icon(Icons.check), - padding: EdgeInsets.all(0), + child: const Icon(Icons.check), + padding: const EdgeInsets.all(0), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, onPressed: () { setState(() { diff --git a/lib/dualis/service/dualis_scraper.dart b/lib/dualis/service/dualis_scraper.dart index f84dc299..736d9300 100644 --- a/lib/dualis/service/dualis_scraper.dart +++ b/lib/dualis/service/dualis_scraper.dart @@ -13,7 +13,7 @@ import 'package:dhbwstudentapp/schedule/service/schedule_source.dart'; import 'package:http/http.dart'; class DualisScraper { - static final String dualisEndpoint = "https://dualis.dhbw.de"; + static const String dualisEndpoint = "https://dualis.dhbw.de"; Future login( String user, diff --git a/lib/dualis/service/parsing/all_modules_extract.dart b/lib/dualis/service/parsing/all_modules_extract.dart index 2cdff162..81bd1e06 100644 --- a/lib/dualis/service/parsing/all_modules_extract.dart +++ b/lib/dualis/service/parsing/all_modules_extract.dart @@ -10,7 +10,7 @@ class AllModulesExtract { return _extractAllModules(body); } catch (e) { if (e.runtimeType is ParseException) rethrow; - throw new ParseException.withInner(e); + throw ParseException.withInner(e); } } @@ -40,7 +40,7 @@ class AllModulesExtract { var name = cells[1].innerHtml.trim(); var nameHyperlink = cells[1].getElementsByTagName("a"); - if (nameHyperlink.length != 0) { + if (nameHyperlink.isNotEmpty) { name = nameHyperlink[0].innerHtml; } @@ -49,7 +49,7 @@ class AllModulesExtract { var grade = cells[4].innerHtml; var state = cells[5].children[0].attributes["alt"]; - var stateEnum; + ExamState stateEnum; if (state == "Bestanden") { stateEnum = ExamState.Passed; diff --git a/lib/dualis/service/parsing/exams_from_module_details_extract.dart b/lib/dualis/service/parsing/exams_from_module_details_extract.dart index 52895ea9..f592e4d3 100644 --- a/lib/dualis/service/parsing/exams_from_module_details_extract.dart +++ b/lib/dualis/service/parsing/exams_from_module_details_extract.dart @@ -26,14 +26,14 @@ class ExamsFromModuleDetailsExtract { for (var row in tableExamsRows) { // Save the try for all following exams var level01s = row.getElementsByClassName("level01"); - if (level01s.length > 0) { + if (level01s.isNotEmpty) { currentTry = level01s[0].innerHtml; continue; } // Save the module for all following exams var level02s = row.getElementsByClassName("level02"); - if (level02s.length > 0) { + if (level02s.isNotEmpty) { currentModule = level02s[0].innerHtml; continue; } diff --git a/lib/dualis/service/parsing/login_redirect_url_extract.dart b/lib/dualis/service/parsing/login_redirect_url_extract.dart index bf088fb3..847edff5 100644 --- a/lib/dualis/service/parsing/login_redirect_url_extract.dart +++ b/lib/dualis/service/parsing/login_redirect_url_extract.dart @@ -6,7 +6,7 @@ class LoginRedirectUrlExtract { var metaTags = document.getElementsByTagName("meta"); - var redirectContent; + String redirectContent; for (var metaTag in metaTags) { if (!metaTag.attributes.containsKey("http-equiv")) continue; diff --git a/lib/dualis/service/parsing/modules_from_course_result_page_extract.dart b/lib/dualis/service/parsing/modules_from_course_result_page_extract.dart index 31a11c85..bb1ca1e8 100644 --- a/lib/dualis/service/parsing/modules_from_course_result_page_extract.dart +++ b/lib/dualis/service/parsing/modules_from_course_result_page_extract.dart @@ -55,7 +55,7 @@ class ModulesFromCourseResultPageExtract { status = trimAndEscapeString(status); - var statusEnum; + ExamState statusEnum; if (status == "bestanden") { statusEnum = ExamState.Passed; diff --git a/lib/dualis/service/parsing/semesters_from_course_result_page_extract.dart b/lib/dualis/service/parsing/semesters_from_course_result_page_extract.dart index f9b62b7b..bca07e91 100644 --- a/lib/dualis/service/parsing/semesters_from_course_result_page_extract.dart +++ b/lib/dualis/service/parsing/semesters_from_course_result_page_extract.dart @@ -32,7 +32,7 @@ class SemestersFromCourseResultPageExtract { var id = option.attributes["value"]; var name = option.innerHtml; - var detailsUrl; + String detailsUrl; if (url != null) { detailsUrl = url + id; diff --git a/lib/dualis/ui/dualis_navigation_entry.dart b/lib/dualis/ui/dualis_navigation_entry.dart index a7c3ce6a..2169d633 100644 --- a/lib/dualis/ui/dualis_navigation_entry.dart +++ b/lib/dualis/ui/dualis_navigation_entry.dart @@ -56,7 +56,7 @@ class DualisNavigationEntry extends NavigationEntry { tooltip: L.of(context).helpButtonTooltip, ) : IconButton( - icon: Icon(CustomIcons.logout), + icon: const Icon(CustomIcons.logout), onPressed: () async { await _viewModel.logout(); }, diff --git a/lib/dualis/ui/dualis_page.dart b/lib/dualis/ui/dualis_page.dart index cbe28871..1c477dda 100644 --- a/lib/dualis/ui/dualis_page.dart +++ b/lib/dualis/ui/dualis_page.dart @@ -40,7 +40,7 @@ class DualisPage extends StatelessWidget { } return AnimatedSwitcher( - duration: Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), child: widget, ); } diff --git a/lib/dualis/ui/exam_results_page/exam_results_page.dart b/lib/dualis/ui/exam_results_page/exam_results_page.dart index 83f6aabd..e8a28b56 100644 --- a/lib/dualis/ui/exam_results_page/exam_results_page.dart +++ b/lib/dualis/ui/exam_results_page/exam_results_page.dart @@ -31,7 +31,7 @@ class ExamResultsPage extends StatelessWidget { Padding( padding: const EdgeInsets.fromLTRB(24, 0, 0, 0), child: PropertyChangeConsumer( - properties: [ + properties: const [ "currentSemesterName", "allSemesterNames", ], @@ -58,7 +58,7 @@ class ExamResultsPage extends StatelessWidget { ), ), PropertyChangeConsumer( - properties: ["currentSemester"], + properties: const ["currentSemester"], builder: ( BuildContext context, StudyGradesViewModel model, @@ -66,8 +66,8 @@ class ExamResultsPage extends StatelessWidget { ) => model.currentSemester != null ? buildModulesColumn(context, model) - : Padding( - padding: const EdgeInsets.fromLTRB(0, 16, 0, 0), + : const Padding( + padding: EdgeInsets.fromLTRB(0, 16, 0, 0), child: Center(child: CircularProgressIndicator()), ), ), @@ -93,7 +93,7 @@ class ExamResultsPage extends StatelessWidget { key: ValueKey("semester_${viewModel.currentSemester?.name}"), children: buildModulesDataTables(context, viewModel), ), - duration: Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), ); } @@ -163,7 +163,7 @@ class ExamResultsPage extends StatelessWidget { child: Align( alignment: Alignment.bottomLeft, child: Padding( - padding: EdgeInsets.fromLTRB(0, 0, 10, 16), + padding: const EdgeInsets.fromLTRB(0, 0, 10, 16), child: Text( (module.name ?? ""), style: Theme.of(context).textTheme.subtitle2, @@ -182,7 +182,7 @@ class ExamResultsPage extends StatelessWidget { child: Align( alignment: Alignment.bottomLeft, child: Padding( - padding: EdgeInsets.fromLTRB(0, 0, 10, 16), + padding: const EdgeInsets.fromLTRB(0, 0, 10, 16), child: Text( "${L.of(context).dualisExamResultsCreditsColumnHeader}: ${module.credits}"), ), diff --git a/lib/dualis/ui/study_overview/study_overview_page.dart b/lib/dualis/ui/study_overview/study_overview_page.dart index b731af4c..1cd0f267 100644 --- a/lib/dualis/ui/study_overview/study_overview_page.dart +++ b/lib/dualis/ui/study_overview/study_overview_page.dart @@ -36,7 +36,7 @@ class StudyOverviewPage extends StatelessWidget { style: Theme.of(context).textTheme.headline6, ), PropertyChangeConsumer( - properties: ["studyGrades"], + properties: const ["studyGrades"], builder: ( BuildContext context, StudyGradesViewModel model, @@ -126,7 +126,7 @@ class StudyOverviewPage extends StatelessWidget { ), ), PropertyChangeConsumer( - properties: ["allModules"], + properties: const ["allModules"], builder: ( BuildContext context, StudyGradesViewModel model, @@ -142,8 +142,8 @@ class StudyOverviewPage extends StatelessWidget { } Padding buildProgressIndicator() { - return Padding( - padding: const EdgeInsets.all(24), + return const Padding( + padding: EdgeInsets.all(24), child: Center(child: CircularProgressIndicator()), ); } @@ -190,7 +190,7 @@ class StudyOverviewPage extends StatelessWidget { numeric: true, ), DataColumn( - label: Text(""), + label: const Text(""), numeric: true, tooltip: L.of(context).dualisOverviewPassedColumnHeader, ), diff --git a/lib/dualis/ui/viewmodels/study_grades_view_model.dart b/lib/dualis/ui/viewmodels/study_grades_view_model.dart index aa46977e..9235d7c8 100644 --- a/lib/dualis/ui/viewmodels/study_grades_view_model.dart +++ b/lib/dualis/ui/viewmodels/study_grades_view_model.dart @@ -26,19 +26,19 @@ class StudyGradesViewModel extends BaseViewModel { StudyGrades _studyGrades; StudyGrades get studyGrades => _studyGrades; - CancelableMutex _studyGradesCancellationToken = CancelableMutex(); + final CancelableMutex _studyGradesCancellationToken = CancelableMutex(); List _allModules; List get allModules => _allModules; - CancelableMutex _allModulesCancellationToken = CancelableMutex(); + final CancelableMutex _allModulesCancellationToken = CancelableMutex(); List _semesterNames; List get allSemesterNames => _semesterNames; - CancelableMutex _semesterNamesCancellationToken = CancelableMutex(); + final CancelableMutex _semesterNamesCancellationToken = CancelableMutex(); Semester _currentSemester; Semester get currentSemester => _currentSemester; - CancelableMutex _currentSemesterCancellationToken = CancelableMutex(); + final CancelableMutex _currentSemesterCancellationToken = CancelableMutex(); String _currentSemesterName; String get currentSemesterName => _currentSemesterName; @@ -200,7 +200,7 @@ class StudyGradesViewModel extends BaseViewModel { Future _loadInitialSemester() async { if (_semesterNames == null) return; - if (_semesterNames.length == 0) return; + if (_semesterNames.isEmpty) return; var lastViewedSemester = await _preferencesProvider.getLastViewedSemester(); @@ -231,7 +231,7 @@ class StudyGradesViewModel extends BaseViewModel { _currentSemester = null; _currentSemesterName = null; _currentLoadingSemesterName = null; - + notifyListeners(); print("Logged out"); diff --git a/lib/dualis/ui/widgets/grade_state_icon.dart b/lib/dualis/ui/widgets/grade_state_icon.dart index 4cee7f66..8c3e1236 100644 --- a/lib/dualis/ui/widgets/grade_state_icon.dart +++ b/lib/dualis/ui/widgets/grade_state_icon.dart @@ -13,9 +13,9 @@ class GradeStateIcon extends StatelessWidget { Widget build(BuildContext context) { switch (state) { case ExamState.Passed: - return Icon(Icons.check, color: Colors.green); + return const Icon(Icons.check, color: Colors.green); case ExamState.Failed: - return Icon(Icons.close, color: Colors.red); + return const Icon(Icons.close, color: Colors.red); case ExamState.Pending: return Container(); } diff --git a/lib/dualis/ui/widgets/login_form_widget.dart b/lib/dualis/ui/widgets/login_form_widget.dart index 802841b8..507e6961 100644 --- a/lib/dualis/ui/widgets/login_form_widget.dart +++ b/lib/dualis/ui/widgets/login_form_widget.dart @@ -55,8 +55,10 @@ class _LoginFormState extends State { bool _loginFailed = false; bool _isLoading = false; - TextEditingController _usernameEditingController = TextEditingController(); - TextEditingController _passwordEditingController = TextEditingController(); + final TextEditingController _usernameEditingController = + TextEditingController(); + final TextEditingController _passwordEditingController = + TextEditingController(); _LoginFormState( this._onLogin, @@ -143,7 +145,7 @@ class _LoginFormState extends State { child: Padding( padding: const EdgeInsets.fromLTRB(0, 24, 0, 0), child: _isLoading - ? CircularProgressIndicator() + ? const CircularProgressIndicator() : FlatButton.icon( textColor: Theme.of(context).accentColor, onPressed: () async { diff --git a/lib/schedule/background/background_schedule_update.dart b/lib/schedule/background/background_schedule_update.dart index 5c270487..4e2af319 100644 --- a/lib/schedule/background/background_schedule_update.dart +++ b/lib/schedule/background/background_schedule_update.dart @@ -63,7 +63,7 @@ class BackgroundScheduleUpdate extends TaskCallback { @override Future schedule() async { await scheduler.schedulePeriodic( - Duration(hours: 4), + const Duration(hours: 4), getName(), ); } diff --git a/lib/schedule/business/schedule_diff_calculator.dart b/lib/schedule/business/schedule_diff_calculator.dart index 312909cd..077bdc17 100644 --- a/lib/schedule/business/schedule_diff_calculator.dart +++ b/lib/schedule/business/schedule_diff_calculator.dart @@ -75,12 +75,12 @@ class ScheduleDiffCalculator { (ScheduleEntry e) => e.title == intersectingTitle, ); - if (newElementsWithName.length == 0 && oldElementsWithName.length >= 1) { + if (newElementsWithName.isEmpty && oldElementsWithName.isNotEmpty) { oldEntries.addAll(oldElementsWithName); continue; } - if (oldElementsWithName.length == 0 && newElementsWithName.length >= 1) { + if (oldElementsWithName.isEmpty && newElementsWithName.isNotEmpty) { newEntries.addAll(newElementsWithName); continue; } @@ -169,9 +169,9 @@ class ScheduleDiff { ScheduleDiff({this.addedEntries, this.removedEntries, this.updatedEntries}); bool didSomethingChange() { - return addedEntries.length != 0 || - removedEntries.length != 0 || - updatedEntries.length != 0; + return addedEntries.isNotEmpty || + removedEntries.isNotEmpty || + updatedEntries.isNotEmpty; } } diff --git a/lib/schedule/data/schedule_entry_entity.dart b/lib/schedule/data/schedule_entry_entity.dart index c533bc76..2f532d8f 100644 --- a/lib/schedule/data/schedule_entry_entity.dart +++ b/lib/schedule/data/schedule_entry_entity.dart @@ -14,17 +14,17 @@ class ScheduleEntryEntity extends DatabaseEntity { @override void fromMap(Map map) { - var startDate; + DateTime startDate; if (map["start"] != null) { startDate = DateTime.fromMillisecondsSinceEpoch(map["start"]); } - var endDate; + DateTime endDate; if (map["end"] != null) { endDate = DateTime.fromMillisecondsSinceEpoch(map["end"]); } - _scheduleEntry = new ScheduleEntry( + _scheduleEntry = ScheduleEntry( id: map["id"], start: startDate, end: endDate, diff --git a/lib/schedule/data/schedule_entry_repository.dart b/lib/schedule/data/schedule_entry_repository.dart index b31304e0..029c0013 100644 --- a/lib/schedule/data/schedule_entry_repository.dart +++ b/lib/schedule/data/schedule_entry_repository.dart @@ -9,7 +9,7 @@ class ScheduleEntryRepository { ScheduleEntryRepository(this._database); Future queryScheduleForDay(DateTime date) async { - return queryScheduleBetweenDates(date, date.add(Duration(days: 1))); + return queryScheduleBetweenDates(date, date.add(const Duration(days: 1))); } Future queryScheduleBetweenDates( @@ -27,7 +27,7 @@ class ScheduleEntryRepository { for (var row in rows) { schedule.addEntry( - new ScheduleEntryEntity.fromMap(row).asScheduleEntry(), + ScheduleEntryEntity.fromMap(row).asScheduleEntry(), ); } @@ -47,9 +47,9 @@ class ScheduleEntryRepository { ], ); - if (rows.length == 0) return null; + if (rows.isEmpty) return null; - return new ScheduleEntryEntity.fromMap(rows[0]).asScheduleEntry(); + return ScheduleEntryEntity.fromMap(rows[0]).asScheduleEntry(); } Future queryNextScheduleEntry(DateTime dateTime) async { diff --git a/lib/schedule/data/schedule_query_information_entity.dart b/lib/schedule/data/schedule_query_information_entity.dart index 329a4c2d..abd0d5e2 100644 --- a/lib/schedule/data/schedule_query_information_entity.dart +++ b/lib/schedule/data/schedule_query_information_entity.dart @@ -16,23 +16,23 @@ class ScheduleQueryInformationEntity extends DatabaseEntity { @override void fromMap(Map map) { - var startDate; + DateTime startDate; if (map["start"] != null) { startDate = DateTime.fromMillisecondsSinceEpoch(map["start"]); } - var endDate; + DateTime endDate; if (map["end"] != null) { endDate = DateTime.fromMillisecondsSinceEpoch(map["end"]); } - var queryTimeDate; + DateTime queryTimeDate; if (map["end"] != null) { queryTimeDate = DateTime.fromMillisecondsSinceEpoch(map["queryTime"]); } _scheduleQueryInformation = - new ScheduleQueryInformation(startDate, endDate, queryTimeDate); + ScheduleQueryInformation(startDate, endDate, queryTimeDate); } @override diff --git a/lib/schedule/model/schedule.dart b/lib/schedule/model/schedule.dart index d97a321d..450637d7 100644 --- a/lib/schedule/model/schedule.dart +++ b/lib/schedule/model/schedule.dart @@ -3,7 +3,7 @@ import 'package:dhbwstudentapp/schedule/model/schedule_entry.dart'; class Schedule { final List entries; - Schedule() : entries = List(); + Schedule() : entries = []; Schedule.fromList(this.entries); void addEntry(ScheduleEntry entry) { @@ -28,7 +28,7 @@ class Schedule { } DateTime getStartDate() { - if (entries.length == 0) return null; + if (entries.isEmpty) return null; var date = entries?.reduce((ScheduleEntry a, ScheduleEntry b) { return a.start.isBefore(b.start) ? a : b; @@ -38,7 +38,7 @@ class Schedule { } DateTime getEndDate() { - if (entries.length == 0) return null; + if (entries.isEmpty) return null; var date = entries?.reduce((ScheduleEntry a, ScheduleEntry b) { return a.end.isAfter(b.end) ? a : b; diff --git a/lib/schedule/service/error_report_schedule_source_decorator.dart b/lib/schedule/service/error_report_schedule_source_decorator.dart index eaad2112..7671de8c 100644 --- a/lib/schedule/service/error_report_schedule_source_decorator.dart +++ b/lib/schedule/service/error_report_schedule_source_decorator.dart @@ -34,8 +34,10 @@ class ErrorReportScheduleSourceDecorator extends ScheduleSource { } } + @override void setEndpointUrl(String url) => _scheduleSource.setEndpointUrl(url); + @override void validateEndpointUrl(String url) => _scheduleSource.validateEndpointUrl(url); } diff --git a/lib/schedule/service/rapla/rapla_response_parser.dart b/lib/schedule/service/rapla/rapla_response_parser.dart index 0cea4133..17bad382 100644 --- a/lib/schedule/service/rapla/rapla_response_parser.dart +++ b/lib/schedule/service/rapla/rapla_response_parser.dart @@ -95,7 +95,7 @@ class RaplaResponseParser { // selected year in the date selector var comboBoxes = document.getElementsByTagName("select"); - var year; + String year; for (var box in comboBoxes) { if (box.attributes.containsKey("name") && box.attributes["name"] == "year") { @@ -129,7 +129,7 @@ class RaplaResponseParser { var timeAndClassName = value.getElementsByTagName("a"); if (tooltip.length != 1) return null; - if (timeAndClassName.length == 0) return null; + if (timeAndClassName.isEmpty) return null; var start = _parseTime(timeAndClassName[0].text.substring(0, 5), date); var end = _parseTime(timeAndClassName[0].text.substring(7, 12), date); @@ -167,7 +167,7 @@ class RaplaResponseParser { var resource = _extractResources(value); - var scheduleEntry = new ScheduleEntry( + var scheduleEntry = ScheduleEntry( start: start, end: end, title: trimAndEscapeString(title), @@ -193,7 +193,7 @@ class RaplaResponseParser { } Map _parsePropertiesTable(Element infotable) { - var map = Map(); + var map = {}; var labels = infotable.getElementsByClassName(LABEL_CLASS); var values = infotable.getElementsByClassName(VALUE_CLASS); diff --git a/lib/schedule/service/rapla/rapla_schedule_source.dart b/lib/schedule/service/rapla/rapla_schedule_source.dart index 7ac13bd2..b4afd933 100644 --- a/lib/schedule/service/rapla/rapla_schedule_source.dart +++ b/lib/schedule/service/rapla/rapla_schedule_source.dart @@ -7,12 +7,13 @@ import 'package:http/http.dart'; import 'package:http_client_helper/http_client_helper.dart' as http; class RaplaScheduleSource extends ScheduleSource { - final RaplaResponseParser responseParser = new RaplaResponseParser(); + final RaplaResponseParser responseParser = RaplaResponseParser(); String raplaUrl; RaplaScheduleSource({this.raplaUrl}); + @override void setEndpointUrl(String url) { raplaUrl = url; } diff --git a/lib/schedule/ui/dailyschedule/widgets/daily_schedule_entry_widget.dart b/lib/schedule/ui/dailyschedule/widgets/daily_schedule_entry_widget.dart index 45c5db3d..9c0fe1e1 100644 --- a/lib/schedule/ui/dailyschedule/widgets/daily_schedule_entry_widget.dart +++ b/lib/schedule/ui/dailyschedule/widgets/daily_schedule_entry_widget.dart @@ -58,7 +58,7 @@ class DailyScheduleEntryWidget extends StatelessWidget { Expanded( flex: 7, child: Card( - margin: EdgeInsets.all(0), + margin: const EdgeInsets.all(0), elevation: 8, color: scheduleEntryTypeToColor(context, scheduleEntry.type), child: Padding( diff --git a/lib/schedule/ui/notification/next_day_information_notification.dart b/lib/schedule/ui/notification/next_day_information_notification.dart index 2b07d2b4..9ba2e251 100644 --- a/lib/schedule/ui/notification/next_day_information_notification.dart +++ b/lib/schedule/ui/notification/next_day_information_notification.dart @@ -51,9 +51,9 @@ class NextDayInformationNotification extends TaskCallback { ); } - _getNotificationMessage( + String _getNotificationMessage( int daysToNextEntry, ScheduleEntry nextScheduleEntry, DateFormat format) { - var message; + String message; if (daysToNextEntry == 0) { message = interpolate( _localization.notificationNextClassNextClassAtMessage, diff --git a/lib/schedule/ui/schedule_navigation_entry.dart b/lib/schedule/ui/schedule_navigation_entry.dart index 95289ce0..1c0fa0db 100644 --- a/lib/schedule/ui/schedule_navigation_entry.dart +++ b/lib/schedule/ui/schedule_navigation_entry.dart @@ -42,7 +42,7 @@ class ScheduleNavigationEntry extends NavigationEntry { PropertyChangeProvider( value: _viewModel, child: PropertyChangeConsumer( - properties: ["didSetupProperly"], + properties: const ["didSetupProperly"], builder: (BuildContext _, ScheduleViewModel __, Set ___) => _viewModel.didSetupProperly ? Container() diff --git a/lib/schedule/ui/viewmodels/weekly_schedule_view_model.dart b/lib/schedule/ui/viewmodels/weekly_schedule_view_model.dart index 74b69f00..8d3e278d 100644 --- a/lib/schedule/ui/viewmodels/weekly_schedule_view_model.dart +++ b/lib/schedule/ui/viewmodels/weekly_schedule_view_model.dart @@ -36,6 +36,7 @@ class WeeklyScheduleViewModel extends BaseViewModel { Timer _updateNowTimer; final CancelableMutex _updateMutex = CancelableMutex(); + DateTime lastRequestedStart; DateTime lastRequestedEnd; @@ -92,7 +93,7 @@ class WeeklyScheduleViewModel extends BaseViewModel { Future goToToday() async { currentDateStart = toStartOfDay(toMonday(DateTime.now())); - currentDateEnd = currentDateStart.add(Duration(days: 5)); + currentDateEnd = currentDateStart.add(const Duration(days: 5)); await updateSchedule(currentDateStart, currentDateEnd); } @@ -166,13 +167,13 @@ class WeeklyScheduleViewModel extends BaseViewModel { return null; } - void _cancelErrorInFuture() async { + void _cancelErrorInFuture() { if (_errorResetTimer != null) { _errorResetTimer.cancel(); } _errorResetTimer = Timer( - Duration(seconds: 5), + const Duration(seconds: 5), () { updateFailed = false; notifyListeners("updateFailed"); @@ -182,7 +183,7 @@ class WeeklyScheduleViewModel extends BaseViewModel { void ensureUpdateNowTimerRunning() { if (_updateNowTimer == null || !_updateNowTimer.isActive) { - _updateNowTimer = Timer.periodic(Duration(minutes: 1), (_) { + _updateNowTimer = Timer.periodic(const Duration(minutes: 1), (_) { notifyListeners("now"); }); } 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 5a760d91..8847e812 100644 --- a/lib/schedule/ui/weeklyschedule/schedule_entry_detail_bottom_sheet.dart +++ b/lib/schedule/ui/weeklyschedule/schedule_entry_detail_bottom_sheet.dart @@ -36,10 +36,9 @@ class ScheduleEntryDetailBottomSheet extends StatelessWidget { child: Container( height: 8, width: 30, - decoration: new BoxDecoration( + decoration: BoxDecoration( color: colorSeparator(), - borderRadius: - new BorderRadius.all(const Radius.circular(4))), + borderRadius: const BorderRadius.all(Radius.circular(4))), child: null, ), ), diff --git a/lib/schedule/ui/weeklyschedule/weekly_schedule_page.dart b/lib/schedule/ui/weeklyschedule/weekly_schedule_page.dart index e9712bbf..fcd6fe24 100644 --- a/lib/schedule/ui/weeklyschedule/weekly_schedule_page.dart +++ b/lib/schedule/ui/weeklyschedule/weekly_schedule_page.dart @@ -45,7 +45,7 @@ class _WeeklySchedulePageState extends State { builder: (context) => ScheduleEntryDetailBottomSheet( scheduleEntry: entry, ), - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(top: Radius.circular(12.0)), ), ); @@ -81,12 +81,12 @@ class _WeeklySchedulePageState extends State { Padding( padding: const EdgeInsets.all(8.0), child: PropertyChangeConsumer( - properties: ["weekSchedule", "now"], + properties: const ["weekSchedule", "now"], builder: (BuildContext context, WeeklyScheduleViewModel model, Set properties) { return PageTransitionSwitcher( reverse: !model.didUpdateScheduleIntoFuture, - duration: Duration(milliseconds: 300), + duration: const Duration(milliseconds: 300), transitionBuilder: (Widget child, Animation animation, Animation secondaryAnimation) => @@ -118,11 +118,11 @@ class _WeeklySchedulePageState extends State { ), ), PropertyChangeConsumer( - properties: ["isUpdating"], + properties: const ["isUpdating"], builder: (BuildContext context, WeeklyScheduleViewModel model, Set properties) { return model.isUpdating - ? LinearProgressIndicator() + ? const LinearProgressIndicator() : Container(); }, ), @@ -160,7 +160,7 @@ class _WeeklySchedulePageState extends State { Widget buildErrorDisplay(BuildContext context) { return PropertyChangeConsumer( - properties: [ + properties: const [ "updateFailed", ], builder: (BuildContext context, WeeklyScheduleViewModel model, diff --git a/lib/schedule/ui/weeklyschedule/widgets/schedule_entry_widget.dart b/lib/schedule/ui/weeklyschedule/widgets/schedule_entry_widget.dart index 2e1a9d59..55bbc649 100644 --- a/lib/schedule/ui/weeklyschedule/widgets/schedule_entry_widget.dart +++ b/lib/schedule/ui/weeklyschedule/widgets/schedule_entry_widget.dart @@ -23,7 +23,7 @@ class ScheduleEntryWidget extends StatelessWidget { return Card( color: color, elevation: 5, - margin: EdgeInsets.fromLTRB(2, 0, 2, 0), + margin: const EdgeInsets.fromLTRB(2, 0, 2, 0), child: InkWell( onTap: () { if (onScheduleEntryTap != null) onScheduleEntryTap(scheduleEntry); diff --git a/lib/schedule/ui/weeklyschedule/widgets/schedule_widget.dart b/lib/schedule/ui/weeklyschedule/widgets/schedule_widget.dart index 66b62a15..b39a4691 100644 --- a/lib/schedule/ui/weeklyschedule/widgets/schedule_widget.dart +++ b/lib/schedule/ui/weeklyschedule/widgets/schedule_widget.dart @@ -120,7 +120,7 @@ class ScheduleWidget extends StatelessWidget { double hourHeight, double minuteHeight, ) { - var labelWidgets = List(); + var labelWidgets = []; for (var i = displayStartHour; i < displayEndHour; i++) { var hourLabelText = i.toString() + ":00"; @@ -177,9 +177,9 @@ class ScheduleWidget extends StatelessWidget { List buildEntryWidgets( double hourHeight, double minuteHeight, double width, int columns) { if (schedule == null) return []; - if (schedule.entries.length == 0) return []; + if (schedule.entries.isEmpty) return []; - var entryWidgets = List(); + var entryWidgets = []; var columnWidth = width / columns; diff --git a/lib/schedule/ui/widgets/enter_rapla_url_dialog.dart b/lib/schedule/ui/widgets/enter_rapla_url_dialog.dart index 18ac5f06..7dc21ef7 100644 --- a/lib/schedule/ui/widgets/enter_rapla_url_dialog.dart +++ b/lib/schedule/ui/widgets/enter_rapla_url_dialog.dart @@ -11,8 +11,8 @@ class EnterRaplaUrlDialog { final ScheduleSourceSetup _scheduleSource; final TextEditingController _urlTextController = TextEditingController(); - ValueNotifier _hasUrlError = ValueNotifier(false); - ValueNotifier _url = ValueNotifier(""); + final ValueNotifier _hasUrlError = ValueNotifier(false); + final ValueNotifier _url = ValueNotifier(""); EnterRaplaUrlDialog(this._preferencesProvider, this._scheduleSource) { _loadUrl(); diff --git a/lib/schedule/ui/widgets/schedule_empty_state.dart b/lib/schedule/ui/widgets/schedule_empty_state.dart index 1b03ad34..01c96972 100644 --- a/lib/schedule/ui/widgets/schedule_empty_state.dart +++ b/lib/schedule/ui/widgets/schedule_empty_state.dart @@ -21,7 +21,7 @@ class ScheduleEmptyState extends StatelessWidget { boxShadow: [ BoxShadow( color: Theme.of(context).dividerColor, - offset: Offset(0.0, 1.0), + offset: const Offset(0.0, 1.0), blurRadius: 1.0, ), ], diff --git a/lib/ui/main_page.dart b/lib/ui/main_page.dart index db337fc0..1df6468a 100644 --- a/lib/ui/main_page.dart +++ b/lib/ui/main_page.dart @@ -23,7 +23,7 @@ class MainPage extends StatefulWidget { class _MainPageState extends State with NavigatorObserver { bool _rateDialogShown = false; - ValueNotifier _currentEntryIndex = ValueNotifier(0); + final ValueNotifier _currentEntryIndex = ValueNotifier(0); NavigationEntry get currentEntry => navigationEntries[_currentEntryIndex.value]; diff --git a/lib/ui/navigation/router.dart b/lib/ui/navigation/router.dart index 2bb8e124..72c5fe58 100644 --- a/lib/ui/navigation/router.dart +++ b/lib/ui/navigation/router.dart @@ -18,7 +18,7 @@ final List navigationEntries = [ Route generateDrawerRoute(RouteSettings settings) { print("=== === === === === === Navigating to: ${settings.name}"); - var widget; + WidgetBuilder widget; for (var route in navigationEntries) { if (route.route == settings.name) { @@ -34,17 +34,17 @@ Route generateDrawerRoute(RouteSettings settings) { return PageRouteBuilder( settings: settings, - transitionDuration: Duration(milliseconds: 200), + transitionDuration: const Duration(milliseconds: 200), pageBuilder: (context, animation, secondaryAnimation) => widget(context), transitionsBuilder: (context, animation, secondaryAnimation, child) { - var offsetBegin = Offset(0.0, 0.005); - var offsetEnd = Offset.zero; - var offsetTween = Tween(begin: offsetBegin, end: offsetEnd) + const offsetBegin = Offset(0.0, 0.005); + final offsetEnd = Offset.zero; + final offsetTween = Tween(begin: offsetBegin, end: offsetEnd) .chain(CurveTween(curve: Curves.fastOutSlowIn)); - var opacityBegin = 0.0; - var opacityEnd = 1.0; - var opacityTween = Tween(begin: opacityBegin, end: opacityEnd) + const opacityBegin = 0.0; + const opacityEnd = 1.0; + final opacityTween = Tween(begin: opacityBegin, end: opacityEnd) .chain(CurveTween(curve: Curves.fastOutSlowIn)); return SlideTransition( @@ -63,11 +63,11 @@ Route generateDrawerRoute(RouteSettings settings) { Route generateRoute(RouteSettings settings) { print("=== === === === === === Navigating to: ${settings.name}"); - var target; + Widget target; switch (settings.name) { case "onboarding": - target = OnboardingPage(); + target = const OnboardingPage(); break; case "main": target = MainPage(); diff --git a/lib/ui/onboarding/onboarding_page.dart b/lib/ui/onboarding/onboarding_page.dart index 5984f72b..56d3cf7f 100644 --- a/lib/ui/onboarding/onboarding_page.dart +++ b/lib/ui/onboarding/onboarding_page.dart @@ -29,7 +29,7 @@ class _OnboardingPageState extends State void initState() { super.initState(); - viewModel = new OnboardingViewModel( + viewModel = OnboardingViewModel( KiwiContainer().resolve(), KiwiContainer().resolve(), ); @@ -39,7 +39,7 @@ class _OnboardingPageState extends State await _controller.animateTo( viewModel.currentStep / viewModel.onboardingSteps, curve: Curves.ease, - duration: Duration(milliseconds: 300)); + duration: const Duration(milliseconds: 300)); }, ["currentStep"], ); @@ -54,7 +54,7 @@ class _OnboardingPageState extends State child: Scaffold( body: Stack( children: [ - buildContent(), + _buildContent(), OnboardingPageBackground(controller: _controller.view), ], ), @@ -63,13 +63,13 @@ class _OnboardingPageState extends State ); } - Widget buildContent() { + Widget _buildContent() { return GestureDetector( onPanEnd: (details) { if (details.velocity.pixelsPerSecond.dx > 10) { - navigateBack(context); + _navigateBack(context); } else if (details.velocity.pixelsPerSecond.dx < -10) { - navigateNext(context); + _navigateNext(context); } }, behavior: HitTestBehavior.translucent, @@ -81,13 +81,13 @@ class _OnboardingPageState extends State mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - buildActiveOnboardingPage(model), + _buildActiveOnboardingPage(model), OnboardingButtonBar( onPrevious: () { - navigateBack(context); + _navigateBack(context); }, onNext: () { - navigateNext(context); + _navigateNext(context); }, viewModel: viewModel, ), @@ -99,7 +99,7 @@ class _OnboardingPageState extends State ); } - Widget buildActiveOnboardingPage(OnboardingViewModel model) { + Widget _buildActiveOnboardingPage(OnboardingViewModel model) { var contentWidgets = { OnboardingSteps.Start: () => SelectAppFeaturesWidget( viewModel: viewModel, @@ -124,7 +124,7 @@ class _OnboardingPageState extends State return IntrinsicHeight( child: PageTransitionSwitcher( reverse: !model.didStepForward, - duration: Duration(milliseconds: 300), + duration: const Duration(milliseconds: 300), transitionBuilder: ( Widget child, Animation animation, @@ -141,7 +141,7 @@ class _OnboardingPageState extends State ); } - void navigateNext(BuildContext context) { + void _navigateNext(BuildContext context) { if (viewModel.currentStep == viewModel.onboardingSteps - 1) { viewModel.save(); @@ -156,7 +156,7 @@ class _OnboardingPageState extends State } } - void navigateBack(BuildContext context) { + void _navigateBack(BuildContext context) { viewModel.previousPage(); } } diff --git a/lib/ui/onboarding/viewmodels/onboarding_rapla_view_model.dart b/lib/ui/onboarding/viewmodels/onboarding_rapla_view_model.dart index c1d47383..887fce82 100644 --- a/lib/ui/onboarding/viewmodels/onboarding_rapla_view_model.dart +++ b/lib/ui/onboarding/viewmodels/onboarding_rapla_view_model.dart @@ -23,7 +23,7 @@ class OnboardingRaplaViewModel extends OnboardingViewModelBase { void _validateUrl() { try { - new RaplaScheduleSource().validateEndpointUrl(_raplaUrl); + RaplaScheduleSource().validateEndpointUrl(_raplaUrl); urlHasError = false; } catch (e) { urlHasError = true; diff --git a/lib/ui/onboarding/viewmodels/onboarding_view_model.dart b/lib/ui/onboarding/viewmodels/onboarding_view_model.dart index 3db9ee7d..3d7c057a 100644 --- a/lib/ui/onboarding/viewmodels/onboarding_view_model.dart +++ b/lib/ui/onboarding/viewmodels/onboarding_view_model.dart @@ -21,7 +21,7 @@ class OnboardingViewModel extends BaseViewModel { OnboardingSteps.Dualis: true, }; - Map _viewModels = {}; + final Map _viewModels = {}; OnboardingViewModelBase get currentViewModel => _viewModels[_currentPage]; bool get useRapla => usedAppFeatures[OnboardingSteps.Rapla]; @@ -85,7 +85,7 @@ class OnboardingViewModel extends BaseViewModel { } void _setCurrentPage() { - var activeFeatures = []; + final activeFeatures = []; for (var feature in OnboardingSteps.values) { if (usedAppFeatures[feature]) { diff --git a/lib/ui/onboarding/widgets/dots_indicator.dart b/lib/ui/onboarding/widgets/dots_indicator.dart index e195e028..76d1b35c 100644 --- a/lib/ui/onboarding/widgets/dots_indicator.dart +++ b/lib/ui/onboarding/widgets/dots_indicator.dart @@ -20,7 +20,7 @@ class DotsIndicator extends StatelessWidget { child: Container( width: 7.0, height: 7.0, - decoration: new BoxDecoration( + decoration: BoxDecoration( shape: BoxShape.circle, color: i == currentStep ? Theme.of(context).accentColor diff --git a/lib/ui/onboarding/widgets/dualis_login_page.dart b/lib/ui/onboarding/widgets/dualis_login_page.dart index f4651745..7c840e41 100644 --- a/lib/ui/onboarding/widgets/dualis_login_page.dart +++ b/lib/ui/onboarding/widgets/dualis_login_page.dart @@ -6,6 +6,10 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:property_change_notifier/property_change_notifier.dart'; +/// +/// Widget which provides a username and password text field to input login +/// credentials. +/// class DualisLoginCredentialsPage extends StatefulWidget { @override _DualisLoginCredentialsPageState createState() => @@ -14,8 +18,10 @@ class DualisLoginCredentialsPage extends StatefulWidget { class _DualisLoginCredentialsPageState extends State { - TextEditingController _usernameEditingController = TextEditingController(); - TextEditingController _passwordEditingController = TextEditingController(); + final TextEditingController _usernameEditingController = + TextEditingController(); + final TextEditingController _passwordEditingController = + TextEditingController(); @override Widget build(BuildContext context) { @@ -73,7 +79,7 @@ class _DualisLoginCredentialsPageState : Container(), ), viewModel.isLoading - ? SizedBox( + ? const SizedBox( width: 16, height: 16, child: CircularProgressIndicator( @@ -81,7 +87,7 @@ class _DualisLoginCredentialsPageState ), ) : viewModel.loginSuccess - ? Icon( + ? const Icon( Icons.check, color: Colors.green, ) @@ -121,8 +127,8 @@ class _DualisLoginCredentialsPageState ), ), ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 16, 0, 16), + const Padding( + padding: EdgeInsets.fromLTRB(0, 16, 0, 16), child: Divider(), ), Padding( diff --git a/lib/ui/onboarding/widgets/onboarding_button_bar.dart b/lib/ui/onboarding/widgets/onboarding_button_bar.dart index 14acb6cb..c2d06c3b 100644 --- a/lib/ui/onboarding/widgets/onboarding_button_bar.dart +++ b/lib/ui/onboarding/widgets/onboarding_button_bar.dart @@ -47,7 +47,7 @@ class OnboardingButtonBar extends StatelessWidget { bool isFirstPage = viewModel.currentStep == 0; return AnimatedSwitcher( - duration: Duration(milliseconds: 100), + duration: const Duration(milliseconds: 100), child: isFirstPage ? Container() : FlatButton.icon( @@ -62,7 +62,7 @@ class OnboardingButtonBar extends StatelessWidget { Widget _buildNextButton(BuildContext context) { bool isLastPage = viewModel.currentStep == viewModel.onboardingSteps - 1; - var buttonText; + String buttonText; var buttonColor = Theme.of(context).accentColor; if (isLastPage) { @@ -76,7 +76,7 @@ class OnboardingButtonBar extends StatelessWidget { } return AnimatedSwitcher( - duration: Duration(milliseconds: 100), + duration: const Duration(milliseconds: 100), child: FlatButton.icon( key: ValueKey(buttonText), onPressed: onNext, diff --git a/lib/ui/onboarding/widgets/onboarding_page_background.dart b/lib/ui/onboarding/widgets/onboarding_page_background.dart index fa36e3db..b2fdc4f3 100644 --- a/lib/ui/onboarding/widgets/onboarding_page_background.dart +++ b/lib/ui/onboarding/widgets/onboarding_page_background.dart @@ -27,7 +27,7 @@ class OnboardingPageBackground extends StatelessWidget { ).animate( CurvedAnimation( parent: controller, - curve: Interval( + curve: const Interval( 0.0, 1, curve: Curves.linear, @@ -40,7 +40,7 @@ class OnboardingPageBackground extends StatelessWidget { ).animate( CurvedAnimation( parent: controller, - curve: Interval( + curve: const Interval( 0.0, 1, curve: Curves.linear, @@ -53,7 +53,7 @@ class OnboardingPageBackground extends StatelessWidget { ).animate( CurvedAnimation( parent: controller, - curve: Interval( + curve: const Interval( 0.0, 1, curve: Curves.linear, @@ -66,7 +66,7 @@ class OnboardingPageBackground extends StatelessWidget { ).animate( CurvedAnimation( parent: controller, - curve: Interval( + curve: const Interval( 0.0, 1, curve: Curves.linear, @@ -85,7 +85,7 @@ class OnboardingPageBackground extends StatelessWidget { height: 500, color: colorOnboardingDecorationForeground(context), ), - offset: Offset(20, -450), + offset: const Offset(20, -450), ), angle: toRadian(angleTopForeground.value), ), @@ -96,7 +96,7 @@ class OnboardingPageBackground extends StatelessWidget { height: 500, color: colorOnboardingDecorationBackground(context), ), - offset: Offset(20, -480), + offset: const Offset(20, -480), ), angle: toRadian(angleTopBackground.value), ), diff --git a/lib/ui/onboarding/widgets/rapla_url_page.dart b/lib/ui/onboarding/widgets/rapla_url_page.dart index 67e817e5..2a6c7419 100644 --- a/lib/ui/onboarding/widgets/rapla_url_page.dart +++ b/lib/ui/onboarding/widgets/rapla_url_page.dart @@ -11,7 +11,7 @@ class RaplaUrlPage extends StatefulWidget { } class _RaplaUrlPageState extends State { - final TextEditingController _urlTextController = new TextEditingController(); + final TextEditingController _urlTextController = TextEditingController(); @override Widget build(BuildContext context) { @@ -28,8 +28,8 @@ class _RaplaUrlPageState extends State { ), ), ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 16, 0, 0), + const Padding( + padding: EdgeInsets.fromLTRB(0, 16, 0, 0), child: Divider(), ), Text( diff --git a/lib/ui/onboarding/widgets/select_app_features.dart b/lib/ui/onboarding/widgets/select_app_features.dart index 7dd87e58..7623ef1f 100644 --- a/lib/ui/onboarding/widgets/select_app_features.dart +++ b/lib/ui/onboarding/widgets/select_app_features.dart @@ -24,8 +24,8 @@ class SelectAppFeaturesWidget extends StatelessWidget { ), ), ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 16, 0, 0), + const Padding( + padding: EdgeInsets.fromLTRB(0, 16, 0, 0), child: Divider(), ), PropertyChangeConsumer( diff --git a/lib/ui/pager_widget.dart b/lib/ui/pager_widget.dart index 82cb3a29..5d74cf33 100644 --- a/lib/ui/pager_widget.dart +++ b/lib/ui/pager_widget.dart @@ -45,7 +45,7 @@ class _PagerWidgetState extends State { Widget build(BuildContext context) { return Scaffold( body: AnimatedSwitcher( - duration: Duration(milliseconds: 300), + duration: const Duration(milliseconds: 300), child: Column( key: ValueKey(_currentPage), children: [ diff --git a/lib/ui/root_page.dart b/lib/ui/root_page.dart index 0e8ad1d6..cdb3b479 100644 --- a/lib/ui/root_page.dart +++ b/lib/ui/root_page.dart @@ -36,7 +36,7 @@ class _RootPageState extends State { Widget build(BuildContext context) { return PropertyChangeProvider( child: PropertyChangeConsumer( - properties: ["isDarkMode", "isOnboarding"], + properties: const ["isDarkMode", "isOnboarding"], builder: (BuildContext context, RootViewModel model, Set properties) => MaterialApp( theme: ColorPalettes.buildTheme(model.isDarkMode), @@ -49,9 +49,9 @@ class _RootPageState extends State { GlobalCupertinoLocalizations.delegate, DefaultCupertinoLocalizations.delegate, ], - supportedLocales: [ - const Locale('en'), - const Locale('de'), + supportedLocales: const [ + Locale('en'), + Locale('de'), ], onGenerateRoute: generateRoute, ), diff --git a/lib/ui/settings/settings_page.dart b/lib/ui/settings/settings_page.dart index 5d68dad2..a8f3a874 100644 --- a/lib/ui/settings/settings_page.dart +++ b/lib/ui/settings/settings_page.dart @@ -12,6 +12,10 @@ import 'package:property_change_notifier/property_change_notifier.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:kiwi/kiwi.dart'; +/// +/// Widget for the application settings route. Provides access to many settings +/// of the app +/// class SettingsPage extends StatefulWidget { @override _SettingsPageState createState() => _SettingsPageState(); @@ -20,7 +24,8 @@ class SettingsPage extends StatefulWidget { class _SettingsPageState extends State { final SettingsViewModel settingsViewModel = SettingsViewModel( KiwiContainer().resolve(), - KiwiContainer().resolve(NextDayInformationNotification.name), + KiwiContainer().resolve(NextDayInformationNotification.name) + as NextDayInformationNotification, ); @override @@ -86,7 +91,7 @@ class _SettingsPageState extends State { launch(ApplicationSourceCodeUrl); }, ), - Divider(), + const Divider(), ]; } @@ -102,7 +107,7 @@ class _SettingsPageState extends State { ).show(context); }, ), - Divider(), + const Divider(), ]; } @@ -112,7 +117,7 @@ class _SettingsPageState extends State { return [ TitleListTile(title: L.of(context).settingsNotificationsTitle), PropertyChangeConsumer( - properties: [ + properties: const [ "notifyAboutNextDay", ], builder: @@ -125,7 +130,7 @@ class _SettingsPageState extends State { }, ), PropertyChangeConsumer( - properties: [ + properties: const [ "notifyAboutScheduleChanges", ], builder: @@ -137,7 +142,7 @@ class _SettingsPageState extends State { ); }, ), - Divider(), + const Divider(), ]; } else { return []; @@ -148,7 +153,7 @@ class _SettingsPageState extends State { return [ TitleListTile(title: L.of(context).settingsDesign), PropertyChangeConsumer( - properties: [ + properties: const [ "isDarkMode", ], builder: (BuildContext context, RootViewModel model, Set properties) { @@ -159,7 +164,7 @@ class _SettingsPageState extends State { ); }, ), - Divider(), + const Divider(), ]; } } diff --git a/lib/ui/settings/viewmodels/settings_view_model.dart b/lib/ui/settings/viewmodels/settings_view_model.dart index 42ee2c24..f92f942c 100644 --- a/lib/ui/settings/viewmodels/settings_view_model.dart +++ b/lib/ui/settings/viewmodels/settings_view_model.dart @@ -2,20 +2,24 @@ import 'package:dhbwstudentapp/common/data/preferences/preferences_provider.dart import 'package:dhbwstudentapp/common/ui/viewmodels/base_view_model.dart'; import 'package:dhbwstudentapp/schedule/ui/notification/next_day_information_notification.dart'; +/// +/// The view model for the settings page. +/// class SettingsViewModel extends BaseViewModel { + final PreferencesProvider _preferencesProvider; + final NextDayInformationNotification _nextDayInformationNotification; + bool _notifyAboutNextDay = false; bool get notifyAboutNextDay => _notifyAboutNextDay; bool _notifyAboutScheduleChanges = false; bool get notifyAboutScheduleChanges => _notifyAboutScheduleChanges; - final PreferencesProvider _preferencesProvider; - - final NextDayInformationNotification _nextDayInformationNotification; - SettingsViewModel( - this._preferencesProvider, this._nextDayInformationNotification) { - loadPreferences(); + this._preferencesProvider, + this._nextDayInformationNotification, + ) { + _loadPreferences(); } Future setNotifyAboutScheduleChanges(bool value) async { @@ -39,7 +43,7 @@ class SettingsViewModel extends BaseViewModel { await _nextDayInformationNotification.cancel(); } - Future loadPreferences() async { + Future _loadPreferences() async { _notifyAboutNextDay = await _preferencesProvider.getNotifyAboutNextDay(); _notifyAboutScheduleChanges = await _preferencesProvider.getNotifyAboutScheduleChanges(); diff --git a/test/date_management/service/parsing/all_dates_extract_test.dart b/test/date_management/service/parsing/all_dates_extract_test.dart index c61bffbd..feda9186 100644 --- a/test/date_management/service/parsing/all_dates_extract_test.dart +++ b/test/date_management/service/parsing/all_dates_extract_test.dart @@ -4,7 +4,7 @@ import 'package:dhbwstudentapp/date_management/service/parsing/all_dates_extract import 'package:test/test.dart'; Future main() async { - var allDatesPage = await new File(Directory.current.absolute.path + + var allDatesPage = await File(Directory.current.absolute.path + '/test/date_management/service/parsing/html_resources/all_dates.html') .readAsString(); diff --git a/test/dualis/service/parsing/all_modules_extract_test.dart b/test/dualis/service/parsing/all_modules_extract_test.dart index fe0aa60e..faf73b78 100644 --- a/test/dualis/service/parsing/all_modules_extract_test.dart +++ b/test/dualis/service/parsing/all_modules_extract_test.dart @@ -6,7 +6,7 @@ import 'package:dhbwstudentapp/dualis/service/parsing/parsing_utils.dart'; import 'package:test/test.dart'; Future main() async { - var studentResultsPage = await new File(Directory.current.absolute.path + + var studentResultsPage = await File(Directory.current.absolute.path + '/test/dualis/service/parsing/html_resources/student_results.html') .readAsString(); diff --git a/test/dualis/service/parsing/exams_from_module_details_extract_test.dart b/test/dualis/service/parsing/exams_from_module_details_extract_test.dart index 2098f521..55e997c9 100644 --- a/test/dualis/service/parsing/exams_from_module_details_extract_test.dart +++ b/test/dualis/service/parsing/exams_from_module_details_extract_test.dart @@ -5,7 +5,7 @@ import 'package:dhbwstudentapp/dualis/service/parsing/parsing_utils.dart'; import 'package:test/test.dart'; Future main() async { - var moduleDetailsPage = await new File(Directory.current.absolute.path + + var moduleDetailsPage = await File(Directory.current.absolute.path + '/test/dualis/service/parsing/html_resources/module_details.html') .readAsString(); diff --git a/test/dualis/service/parsing/modules_from_course_result_page_extract_test.dart b/test/dualis/service/parsing/modules_from_course_result_page_extract_test.dart index b54d1fca..28bcc7d9 100644 --- a/test/dualis/service/parsing/modules_from_course_result_page_extract_test.dart +++ b/test/dualis/service/parsing/modules_from_course_result_page_extract_test.dart @@ -5,7 +5,7 @@ import 'package:dhbwstudentapp/dualis/service/parsing/parsing_utils.dart'; import 'package:test/test.dart'; Future main() async { - var courseResultsPage = await new File(Directory.current.absolute.path + + var courseResultsPage = await File(Directory.current.absolute.path + '/test/dualis/service/parsing/html_resources/course_results.html') .readAsString(); diff --git a/test/dualis/service/parsing/semesters_from_course_result_page_extract_test.dart b/test/dualis/service/parsing/semesters_from_course_result_page_extract_test.dart index 0815c692..261c3692 100644 --- a/test/dualis/service/parsing/semesters_from_course_result_page_extract_test.dart +++ b/test/dualis/service/parsing/semesters_from_course_result_page_extract_test.dart @@ -5,7 +5,7 @@ import 'package:dhbwstudentapp/dualis/service/parsing/semesters_from_course_resu import 'package:test/test.dart'; Future main() async { - var courseResultsPage = await new File(Directory.current.absolute.path + + var courseResultsPage = await File(Directory.current.absolute.path + '/test/dualis/service/parsing/html_resources/course_results.html') .readAsString(); diff --git a/test/dualis/service/parsing/study_grades_from_student_results_page_extract_test.dart b/test/dualis/service/parsing/study_grades_from_student_results_page_extract_test.dart index 1f372e78..660e0747 100644 --- a/test/dualis/service/parsing/study_grades_from_student_results_page_extract_test.dart +++ b/test/dualis/service/parsing/study_grades_from_student_results_page_extract_test.dart @@ -5,7 +5,7 @@ import 'package:dhbwstudentapp/dualis/service/parsing/study_grades_from_student_ import 'package:test/test.dart'; Future main() async { - var studentResultsPage = await new File(Directory.current.absolute.path + + var studentResultsPage = await File(Directory.current.absolute.path + '/test/dualis/service/parsing/html_resources/student_results.html') .readAsString(); diff --git a/test/dualis/service/parsing/urls_from_main_page_extract_test.dart b/test/dualis/service/parsing/urls_from_main_page_extract_test.dart index 10d1347b..fef8e0d8 100644 --- a/test/dualis/service/parsing/urls_from_main_page_extract_test.dart +++ b/test/dualis/service/parsing/urls_from_main_page_extract_test.dart @@ -5,7 +5,7 @@ import 'package:dhbwstudentapp/dualis/service/parsing/urls_from_main_page_extrac import 'package:test/test.dart'; Future main() async { - var mainPage = await new File(Directory.current.absolute.path + + var mainPage = await File(Directory.current.absolute.path + '/test/dualis/service/parsing/html_resources/main_page.html') .readAsString(); diff --git a/test/schedule/business/schedule_diff_calculator_test.dart b/test/schedule/business/schedule_diff_calculator_test.dart index dcb031cd..89b834d7 100644 --- a/test/schedule/business/schedule_diff_calculator_test.dart +++ b/test/schedule/business/schedule_diff_calculator_test.dart @@ -18,15 +18,15 @@ void main() { }); test('Diff detect removed entry', () async { - var calculator = ScheduleDiffCalculator(); + final calculator = ScheduleDiffCalculator(); - var oldSchedule = generateSchedule(); - var newSchedule = generateSchedule(); + final oldSchedule = generateSchedule(); + final newSchedule = generateSchedule(); - var removedEntry = oldSchedule.entries[0]; + final removedEntry = oldSchedule.entries[0]; newSchedule.entries.removeAt(0); - var diff = calculator.calculateDiff(oldSchedule, newSchedule); + final diff = calculator.calculateDiff(oldSchedule, newSchedule); expect(diff.removedEntries.length, 1); expect(diff.removedEntries[0], removedEntry); @@ -72,7 +72,7 @@ void main() { title: newSchedule.entries[0].title, professor: newSchedule.entries[0].professor, details: newSchedule.entries[0].details, - start: newSchedule.entries[0].start.add(Duration(minutes: 15)), + start: newSchedule.entries[0].start.add(const Duration(minutes: 15)), end: newSchedule.entries[0].end, ); newSchedule.entries[0] = updatedEntry; @@ -99,7 +99,7 @@ void main() { title: newSchedule.entries[0].title, professor: newSchedule.entries[0].professor, details: newSchedule.entries[0].details, - start: newSchedule.entries[0].start.add(Duration(minutes: 15)), + start: newSchedule.entries[0].start.add(const Duration(minutes: 15)), end: newSchedule.entries[0].end, ); newSchedule.entries[0] = updatedEntry; @@ -127,7 +127,7 @@ void main() { title: newSchedule.entries[2].title, professor: newSchedule.entries[2].professor, details: newSchedule.entries[2].details, - start: newSchedule.entries[2].start.add(Duration(minutes: 15)), + start: newSchedule.entries[2].start.add(const Duration(minutes: 15)), end: newSchedule.entries[2].end, ); newSchedule.entries[2] = updatedEntry1; @@ -138,7 +138,7 @@ void main() { title: newSchedule.entries[3].title, professor: newSchedule.entries[3].professor, details: newSchedule.entries[3].details, - start: newSchedule.entries[3].start.add(Duration(minutes: 15)), + start: newSchedule.entries[3].start.add(const Duration(minutes: 15)), end: newSchedule.entries[3].end, ); newSchedule.entries[3] = updatedEntry2; diff --git a/test/schedule/service/rapla/rapla_response_parser_test.dart b/test/schedule/service/rapla/rapla_response_parser_test.dart index 1f05533d..6140197e 100644 --- a/test/schedule/service/rapla/rapla_response_parser_test.dart +++ b/test/schedule/service/rapla/rapla_response_parser_test.dart @@ -5,7 +5,7 @@ import 'package:dhbwstudentapp/schedule/service/rapla/rapla_response_parser.dart import 'package:test/test.dart'; Future main() async { - var raplaPage = await new File(Directory.current.absolute.path + + var raplaPage = await File(Directory.current.absolute.path + '/test/schedule/service/rapla/html_resources/rapla_response.html') .readAsString();