Skip to content

Commit

Permalink
chore: Upgrade dep
Browse files Browse the repository at this point in the history
refs: #68
  • Loading branch information
apomalyn committed Mar 9, 2024
1 parent bd1863e commit 1dd45bc
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 53 deletions.
2 changes: 0 additions & 2 deletions lib/core/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ mixin Utils {
final tempDate =
currentDate.subtract(Duration(days: currentDate.weekday - 1));
firstDayOfWeek = DateTime(tempDate.year, tempDate.month, tempDate.day);
break;
case StartingDayOfWeek.saturday:
final tempDate = currentDate.subtract(Duration(
days: currentDate.weekday == 6 || currentDate.weekday == 7
? currentDate.weekday - 6
: currentDate.weekday + 1));
firstDayOfWeek = DateTime(tempDate.year, tempDate.month, tempDate.day);
break;
// Sunday as default
default:
final tempDate =
Expand Down
2 changes: 0 additions & 2 deletions lib/core/viewmodels/choose_language_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ class ChooseLanguageViewModel extends BaseViewModel {
case english:
_settingsManager.setLocale('en');
languageSelectedIndex = english;
break;
case french:
_settingsManager.setLocale('fr');
languageSelectedIndex = french;
break;
default:
throw Exception(
'No valid language for the index $index passed in parameters');
Expand Down
2 changes: 0 additions & 2 deletions lib/core/viewmodels/dashboard_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,9 @@ class DashboardViewModel extends FutureViewModel<Map<PreferencesFlag, int>> {
case UpdateCode.force:
isAForcedUpdate = true;
message = appIntl!.update_version_message_force;
break;
case UpdateCode.ask:
isAForcedUpdate = false;
message = appIntl!.update_version_message;
break;
case UpdateCode.none:
return;
}
Expand Down
3 changes: 1 addition & 2 deletions lib/core/viewmodels/emergency_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import 'dart:convert';
import 'package:flutter/services.dart';

// Package imports:
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:webview_flutter/webview_flutter.dart';

// Project imports:
import 'package:notredame/core/viewmodels/security_viewmodel.dart';

class EmergencyViewModel extends SecurityViewModel {
EmergencyViewModel({required AppIntl intl}) : super(intl: intl);
EmergencyViewModel({required super.intl});

/// used to load the emergency procedures html files inside the webView
Future loadHtmlFromAssets(String filename, Brightness brightness,
Expand Down
7 changes: 1 addition & 6 deletions lib/ui/views/dashboard_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import 'package:notredame/ui/widgets/haptics_container.dart';

class DashboardView extends StatefulWidget {
final UpdateCode updateCode;
const DashboardView({Key? key, required this.updateCode}) : super(key: key);
const DashboardView({super.key, required this.updateCode});

@override
_DashboardViewState createState() => _DashboardViewState();
Expand Down Expand Up @@ -104,19 +104,14 @@ class _DashboardViewState extends State<DashboardView>
if (model.remoteConfigService.dashboardMessageActive) {
cards.add(_buildMessageBroadcastCard(model, element));
}
break;
case PreferencesFlag.aboutUsCard:
cards.add(_buildAboutUsCard(model, element));
break;
case PreferencesFlag.scheduleCard:
cards.add(_buildScheduleCard(model, element));
break;
case PreferencesFlag.progressBarCard:
cards.add(_buildProgressBarCard(model, element));
break;
case PreferencesFlag.gradesCard:
cards.add(_buildGradesCards(model, element));
break;

default:
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/views/schedule_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ScheduleView extends StatefulWidget {
@visibleForTesting
final DateTime? initialDay;

const ScheduleView({Key? key, this.initialDay}) : super(key: key);
const ScheduleView({super.key, this.initialDay});

@override
_ScheduleViewState createState() => _ScheduleViewState();
Expand Down Expand Up @@ -223,7 +223,7 @@ class _ScheduleViewState extends State<ScheduleView>
hourIndicatorSettings: calendar_view.HourIndicatorSettings(
color: scheduleLineColor,
),
liveTimeIndicatorSettings: calendar_view.HourIndicatorSettings(
liveTimeIndicatorSettings: calendar_view.LiveTimeIndicatorSettings(
color: chevronColor,
),
scrollOffset: 305,
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/views/startup_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class StartUpView extends StatelessWidget {
Widget build(BuildContext context) =>
ViewModelBuilder<StartUpViewModel>.nonReactive(
viewModelBuilder: () => StartUpViewModel(),
onModelReady: (StartUpViewModel model) {
onViewModelReady: (StartUpViewModel model) {
model.handleStartUp();
},
builder: (context, model, child) => Scaffold(
Expand Down
10 changes: 0 additions & 10 deletions lib/ui/widgets/bottom_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,17 @@ class _BottomBarState extends State<BottomBar> {
switch (routeName) {
case RouterPaths.dashboard:
_currentView = BottomBar.dashboardView;
break;
case RouterPaths.schedule:
_currentView = BottomBar.scheduleView;
break;
case RouterPaths.student:
_currentView = BottomBar.studentView;
break;
case RouterPaths.ets:
case RouterPaths.security:
_currentView = BottomBar.etsView;
break;
case RouterPaths.more:
case RouterPaths.settings:
case RouterPaths.about:
_currentView = BottomBar.moreView;
break;
}

return _currentView;
Expand All @@ -78,23 +73,18 @@ class _BottomBarState extends State<BottomBar> {
case BottomBar.dashboardView:
_navigationService.pushNamedAndRemoveUntil(RouterPaths.dashboard);
_analyticsService.logEvent("BottomBar", "DashboardView clicked");
break;
case BottomBar.scheduleView:
_navigationService.pushNamedAndRemoveUntil(RouterPaths.schedule);
_analyticsService.logEvent("BottomBar", "ScheduleView clicked");
break;
case BottomBar.studentView:
_navigationService.pushNamedAndRemoveUntil(RouterPaths.student);
_analyticsService.logEvent("BottomBar", "StudentView clicked");
break;
case BottomBar.etsView:
_navigationService.pushNamedAndRemoveUntil(RouterPaths.ets);
_analyticsService.logEvent("BottomBar", "EtsView clicked");
break;
case BottomBar.moreView:
_navigationService.pushNamedAndRemoveUntil(RouterPaths.more);
_analyticsService.logEvent("BottomBar", "MoreView clicked");
break;
}
_currentView = index;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/widgets/custom_feedback.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import 'package:notredame/core/models/feedback.dart';
/// The submit button is disabled until the user provides the feedback type and a feedback text.
class CustomFeedbackForm extends StatefulWidget {
const CustomFeedbackForm({
Key? key,
super.key,
required this.onSubmit,
this.scrollController,
}) : super(key: key);
});

final OnSubmit onSubmit;
final ScrollController? scrollController;
Expand Down
5 changes: 2 additions & 3 deletions lib/ui/widgets/dismissible_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ class DismissibleCard extends StatelessWidget {
final bool isBusy;

const DismissibleCard(
{Key? key,
{super.key,
required this.onDismissed,
required this.child,
this.elevation = 1,
this.cardColor,
this.isBusy = false})
: super(key: key);
this.isBusy = false});

@override
Widget build(BuildContext context) => Dismissible(
Expand Down
5 changes: 2 additions & 3 deletions lib/ui/widgets/grade_circular_progress.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ class GradeCircularProgress extends StatefulWidget {
final double ratio;

const GradeCircularProgress(this.ratio,
{Key? key,
{super.key,
this.completed = false,
this.finalGrade,
this.studentGrade,
this.averageGrade})
: super(key: key);
this.averageGrade});

@override
_GradeCircularProgressState createState() => _GradeCircularProgressState();
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/widgets/grade_evaluation_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class GradeEvaluationTile extends StatefulWidget {
final bool isFirstEvaluation;

const GradeEvaluationTile(this.evaluation,
{Key? key, this.completed = false, this.isFirstEvaluation = false})
: super(key: key);
{super.key, this.completed = false, this.isFirstEvaluation = false});

@override
_GradeEvaluationTileState createState() => _GradeEvaluationTileState();
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/widgets/grade_not_available.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class GradeNotAvailable extends StatelessWidget {
final bool isEvaluationPeriod;

const GradeNotAvailable(
{Key? key, this.onPressed, this.isEvaluationPeriod = false})
: super(key: key);
{super.key, this.onPressed, this.isEvaluationPeriod = false});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/haptics_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:flutter/services.dart';
class HapticsContainer extends StatefulWidget {
final Widget child;

const HapticsContainer({Key? key, required this.child}) : super(key: key);
const HapticsContainer({super.key, required this.child});

@override
_HapticsContainerState createState() => _HapticsContainerState();
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/widgets/password_text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class PasswordFormField extends StatefulWidget {
final VoidCallback onEditionComplete;

const PasswordFormField(
{Key? key, required this.validator, required this.onEditionComplete})
: super(key: key);
{super.key, required this.validator, required this.onEditionComplete});

@override
_PasswordFormFieldState createState() => _PasswordFormFieldState();
Expand Down
5 changes: 2 additions & 3 deletions lib/ui/widgets/schedule_calendar_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ScheduleCalendarTile extends StatefulWidget {
final BuildContext buildContext;

const ScheduleCalendarTile(
{Key? key,
{super.key,
this.title,
this.description,
this.titleStyle,
Expand All @@ -28,8 +28,7 @@ class ScheduleCalendarTile extends StatefulWidget {
this.borderRadius,
this.start,
this.end,
required this.buildContext})
: super(key: key);
required this.buildContext});

@override
_ScheduleCalendarTileState createState() => _ScheduleCalendarTileState();
Expand Down
10 changes: 4 additions & 6 deletions lib/ui/widgets/schedule_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import 'package:notredame/ui/utils/app_theme.dart';
class ScheduleSettings extends StatefulWidget {
final bool showHandle;

const ScheduleSettings({Key? key, this.showHandle = true}) : super(key: key);
const ScheduleSettings({super.key, this.showHandle = true});

@override
_ScheduleSettingsState createState() => _ScheduleSettingsState();
Expand Down Expand Up @@ -74,11 +74,10 @@ class _ScheduleSettingsState extends State<ScheduleSettings> {
),
Expanded(
child: ListTileTheme(
selectedColor: Theme.of(context).textTheme.bodyLarge !.color,
selectedColor: Theme.of(context).textTheme.bodyLarge!.color,
child: ListView(
key: const ValueKey("SettingsScrollingArea"),
children: _buildSettings(
context, model! as ScheduleSettingsViewModel),
children: _buildSettings(context, model),
),
),
),
Expand Down Expand Up @@ -149,7 +148,7 @@ class _ScheduleSettingsState extends State<ScheduleSettings> {
title: Text(AppIntl.of(context)!.course_activity_group_both),
));

if(model.scheduleActivitiesByCourse[courseActivitiesAcronym] != null) {
if (model.scheduleActivitiesByCourse[courseActivitiesAcronym] != null) {
for (final course
in model.scheduleActivitiesByCourse[courseActivitiesAcronym]!) {
tiles.add(ListTile(
Expand All @@ -162,7 +161,6 @@ class _ScheduleSettingsState extends State<ScheduleSettings> {
));
}
}


if (model.scheduleActivitiesByCourse.values.length > 1) {
tiles.add(const Divider(endIndent: 50, thickness: 1.5));
Expand Down
2 changes: 0 additions & 2 deletions test/viewmodels/profile_viewmodel_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import 'package:notredame/core/constants/programs_credits.dart';
import 'package:notredame/core/managers/user_repository.dart';
import 'package:notredame/core/viewmodels/profile_viewmodel.dart';
import '../helpers.dart';
import '../mock/managers/settings_manager_mock.dart';
import '../mock/managers/user_repository_mock.dart';

late UserRepositoryMock userRepositoryMock;
late SettingsManagerMock settingsManagerMock;

late ProfileViewModel viewModel;

Expand Down

0 comments on commit 1dd45bc

Please sign in to comment.