diff --git a/filcnaplo/assets/animations/backpack-2.riv b/filcnaplo/assets/animations/backpack-2.riv new file mode 100644 index 0000000..68282dc Binary files /dev/null and b/filcnaplo/assets/animations/backpack-2.riv differ diff --git a/filcnaplo/lib/database/init.dart b/filcnaplo/lib/database/init.dart index b947ef8..1e07402 100644 --- a/filcnaplo/lib/database/init.dart +++ b/filcnaplo/lib/database/init.dart @@ -63,7 +63,7 @@ Future initDB() async { "grades": "[]", "timetable": "[]", "exams": "[]", "homework": "[]", "messages": "[]", "notes": "[]", "events": "[]", "absences": "[]", "group_averages": "[]", // "subject_lesson_count": "{}", // non kreta data - "last_seen_grade": "0", + "last_seen_grade": 0, }); } catch (error) { print("ERROR: migrateDB: $error"); diff --git a/filcnaplo/lib/ui/filter/widgets.dart b/filcnaplo/lib/ui/filter/widgets.dart index 8dfbbce..b2f75ef 100644 --- a/filcnaplo/lib/ui/filter/widgets.dart +++ b/filcnaplo/lib/ui/filter/widgets.dart @@ -27,7 +27,7 @@ import 'package:provider/provider.dart'; const List homeFilters = [FilterType.all, FilterType.grades, FilterType.messages, FilterType.absences]; -enum FilterType { all, grades, messages, absences, homework, exams, notes, events, lessons, updates, certifications, missedExams } +enum FilterType { all, grades, newGrades, messages, absences, homework, exams, notes, events, lessons, updates, certifications, missedExams } Future> getFilterWidgets(FilterType activeData, {bool absencesNoExcused = false, required BuildContext context}) async { final gradeProvider = Provider.of(context); @@ -62,7 +62,13 @@ Future> getFilterWidgets(FilterType activeData, {bool absencesN // Grades case FilterType.grades: - items = grade_filter.getWidgets(gradeProvider.grades); + items = grade_filter.getWidgets(gradeProvider.grades, gradeProvider.lastSeenDate); + items.addAll(await getFilterWidgets(FilterType.newGrades, context: context)); + break; + + // Grades + case FilterType.newGrades: + items = grade_filter.getNewWidgets(gradeProvider.grades, gradeProvider.lastSeenDate); break; // Certifications diff --git a/filcnaplo/lib/ui/filter/widgets/grades.dart b/filcnaplo/lib/ui/filter/widgets/grades.dart index 4092607..111826b 100644 --- a/filcnaplo/lib/ui/filter/widgets/grades.dart +++ b/filcnaplo/lib/ui/filter/widgets/grades.dart @@ -2,12 +2,13 @@ import 'package:filcnaplo/ui/date_widget.dart'; import 'package:filcnaplo/utils/platform.dart'; import 'package:filcnaplo_kreta_api/models/grade.dart'; import 'package:filcnaplo_mobile_ui/common/widgets/grade/grade_viewable.dart' as mobile; +import 'package:filcnaplo_mobile_ui/common/widgets/grade/new_grades.dart' as mobile; import 'package:filcnaplo_desktop_ui/common/widgets/grade/grade_viewable.dart' as desktop; -List getWidgets(List providerGrades) { +List getWidgets(List providerGrades, DateTime? lastSeenDate) { List items = []; for (var grade in providerGrades) { - if (grade.type == GradeType.midYear) { + if (grade.type == GradeType.midYear && !(lastSeenDate != null && grade.date.isAfter(lastSeenDate))) { items.add(DateWidget( key: grade.id, date: grade.date, @@ -17,3 +18,22 @@ List getWidgets(List providerGrades) { } return items; } + +List getNewWidgets(List providerGrades, DateTime? lastSeenDate) { + List items = []; + List newGrades = []; + for (var grade in providerGrades) { + if (grade.type == GradeType.midYear && !(lastSeenDate != null && !grade.date.isAfter(lastSeenDate))) { + newGrades.add(grade); + } + } + newGrades.sort((a, b) => a.date.compareTo(b.date)); + if (newGrades.isNotEmpty) { + items.add(DateWidget( + key: newGrades.last.id, + date: newGrades.last.date, + widget: mobile.NewGradesSurprise(newGrades), + )); + } + return items; +} diff --git a/filcnaplo/lib/ui/widgets/grade/grade_tile.dart b/filcnaplo/lib/ui/widgets/grade/grade_tile.dart index 117312f..7884946 100644 --- a/filcnaplo/lib/ui/widgets/grade/grade_tile.dart +++ b/filcnaplo/lib/ui/widgets/grade/grade_tile.dart @@ -120,11 +120,23 @@ class GradeTile extends StatelessWidget { } class GradeValueWidget extends StatelessWidget { - const GradeValueWidget(this.value, {Key? key, this.size = 38.0, this.fill = false, this.complemented = false}) : super(key: key); + const GradeValueWidget( + this.value, { + Key? key, + this.size = 38.0, + this.fill = false, + this.contrast = false, + this.shadow = false, + this.outline = false, + this.complemented = false, + }) : super(key: key); final GradeValue value; final double size; final bool fill; + final bool contrast; + final bool shadow; + final bool outline; final bool complemented; @override @@ -164,11 +176,11 @@ class GradeValueWidget extends StatelessWidget { style: TextStyle( fontWeight: value.weight == 50 ? FontWeight.w600 : FontWeight.bold, fontSize: size, - color: color, + color: contrast ? Colors.white : color, shadows: [ if (value.weight >= 200) Shadow( - color: color.withOpacity(.4), + color: (contrast ? Colors.white : color).withOpacity(.4), offset: const Offset(-4, -3), ) ], @@ -195,8 +207,15 @@ class GradeValueWidget extends StatelessWidget { width: size * 1.4, height: size * 1.4, decoration: BoxDecoration( - color: color.withOpacity(.25), + color: color.withOpacity(contrast ? 1.0 : .25), shape: BoxShape.circle, + boxShadow: [ + if (shadow) + BoxShadow( + color: color, + blurRadius: 62.0, + ) + ], ), child: Center(child: valueText), ) diff --git a/filcnaplo/pubspec.yaml b/filcnaplo/pubspec.yaml index de8b4ed..9a88042 100644 --- a/filcnaplo/pubspec.yaml +++ b/filcnaplo/pubspec.yaml @@ -51,6 +51,8 @@ dependencies: live_activities: ^1.0.0 animated_flip_counter: ^0.2.5 lottie: ^1.4.3 + rive: ^0.9.1 + animated_background: ^2.0.0 dev_dependencies: flutter_lints: ^2.0.1 @@ -64,7 +66,7 @@ flutter: assets: - assets/icons/ic_launcher.png - assets/icons/ic_splash.png - - assets/animations/bell-alert.json + - assets/animations/ fonts: - family: FilcIcons diff --git a/filcnaplo_mobile_ui b/filcnaplo_mobile_ui index a417359..99d8638 160000 --- a/filcnaplo_mobile_ui +++ b/filcnaplo_mobile_ui @@ -1 +1 @@ -Subproject commit a417359d1aa9405e6a6ae80a96c1c1451f390323 +Subproject commit 99d8638344cbe14184fbe7c4edd9bbf9513a077f