From 0369213e28a33a6196e34da75ec21b0c83f7ec3d Mon Sep 17 00:00:00 2001 From: chababeric Date: Fri, 29 Nov 2024 21:15:58 -0500 Subject: [PATCH] Remove model from view --- lib/features/dashboard/dashboard_viewmodel.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/features/dashboard/dashboard_viewmodel.dart b/lib/features/dashboard/dashboard_viewmodel.dart index 8708cf6e7..46193139f 100644 --- a/lib/features/dashboard/dashboard_viewmodel.dart +++ b/lib/features/dashboard/dashboard_viewmodel.dart @@ -307,6 +307,13 @@ class DashboardViewModel extends FutureViewModel> { _sessionDays = getSessionDays(); _progress = getSessionProgress(); + _upcomingEvents = importantDates.asMap().entries.where((entry) { + DateTime date = entry.value; + DateTime now = DateTime.now(); + + return now.isAfter(date.subtract(const Duration(days: 3))) && now.isBefore(date.add(const Duration(days: 1))); + }).toList(); + _upcomingEvents = importantDates.asMap().entries.where((entry) { DateTime date = entry.value; DateTime now = DateTime.now();