From 8c118eedc185746c178a984b217dc956c2c69de8 Mon Sep 17 00:00:00 2001 From: Kima Date: Wed, 15 May 2024 19:31:48 +0200 Subject: [PATCH] finished 5s streak thing --- .../common/profile_image/profile_button.dart | 1 + .../common/profile_image/profile_image.dart | 39 +++++++++++++++++ .../lib/pages/absences/absences_page.dart | 1 + .../lib/pages/grades/grades_page.dart | 1 + .../lib/pages/home/home_page.dart | 1 + .../lib/pages/messages/messages_page.dart | 1 + .../lib/pages/notes/notes_page.dart | 1 + .../lib/pages/timetable/timetable_page.dart | 1 + .../lib/screens/settings/settings_screen.dart | 42 +++++++++++++++++++ .../settings/settings_screen.i18n.dart | 9 ++++ 10 files changed, 97 insertions(+) diff --git a/refilc_mobile_ui/lib/common/profile_image/profile_button.dart b/refilc_mobile_ui/lib/common/profile_image/profile_button.dart index e63eba2..630ba0c 100644 --- a/refilc_mobile_ui/lib/common/profile_image/profile_button.dart +++ b/refilc_mobile_ui/lib/common/profile_image/profile_button.dart @@ -65,6 +65,7 @@ class ProfileButton extends StatelessWidget { radius: child.radius, badge: child.badge, role: child.role, + gradeStreak: child.gradeStreak, profilePictureString: child.profilePictureString, onTap: () { showSlidingBottomSheet( diff --git a/refilc_mobile_ui/lib/common/profile_image/profile_image.dart b/refilc_mobile_ui/lib/common/profile_image/profile_image.dart index 440702b..6024a7f 100644 --- a/refilc_mobile_ui/lib/common/profile_image/profile_image.dart +++ b/refilc_mobile_ui/lib/common/profile_image/profile_image.dart @@ -21,6 +21,7 @@ class ProfileImage extends StatefulWidget { this.censored = false, this.profilePictureString = "", this.isNotePfp = false, + this.gradeStreak = false, }); final void Function()? onTap; @@ -35,6 +36,7 @@ class ProfileImage extends StatefulWidget { final bool censored; final String profilePictureString; final bool isNotePfp; + final bool gradeStreak; @override State createState() => _ProfileImageState(); @@ -145,6 +147,20 @@ class _ProfileImageState extends State { color: roleColor, size: widget.radius / 1.3), ), ), + + // streak indicator + // if (widget.gradeStreak) + // SizedBox( + // height: widget.radius * 2, + // width: widget.radius * 2, + // child: Container( + // alignment: Alignment.topLeft, + // child: Text( + // '🔥', + // style: TextStyle(fontSize: widget.radius * 0.9), + // ), + // ), + // ), ], ); } @@ -238,6 +254,29 @@ class _ProfileImageState extends State { ), ), + // streak indicator + if (widget.gradeStreak) + Hero( + tag: "${widget.heroTag!}streak_indicator", + child: FittedBox( + fit: BoxFit.fitHeight, + child: SizedBox( + height: widget.radius * 2, + width: widget.radius * 2, + child: Transform.translate( + offset: Offset(-widget.radius / 4, -widget.radius / 4), + child: Container( + alignment: Alignment.topLeft, + child: Text( + '🔥', + style: TextStyle(fontSize: widget.radius * 0.8), + ), + ), + ), + ), + ), + ), + Material( color: Colors.transparent, clipBehavior: Clip.hardEdge, diff --git a/refilc_mobile_ui/lib/pages/absences/absences_page.dart b/refilc_mobile_ui/lib/pages/absences/absences_page.dart index 1be6ff3..2e15ddc 100644 --- a/refilc_mobile_ui/lib/pages/absences/absences_page.dart +++ b/refilc_mobile_ui/lib/pages/absences/absences_page.dart @@ -169,6 +169,7 @@ class AbsencesPageState extends State badge: updateProvider.available, role: user.role, profilePictureString: user.picture, + gradeStreak: (user.gradeStreak ?? 0) > 1, ), ), ), diff --git a/refilc_mobile_ui/lib/pages/grades/grades_page.dart b/refilc_mobile_ui/lib/pages/grades/grades_page.dart index 0a50cde..798cc9a 100644 --- a/refilc_mobile_ui/lib/pages/grades/grades_page.dart +++ b/refilc_mobile_ui/lib/pages/grades/grades_page.dart @@ -566,6 +566,7 @@ class GradesPageState extends State { badge: updateProvider.available, role: user.role, profilePictureString: user.picture, + gradeStreak: (user.gradeStreak ?? 0) > 1, ), ), ), diff --git a/refilc_mobile_ui/lib/pages/home/home_page.dart b/refilc_mobile_ui/lib/pages/home/home_page.dart index 9aeafea..8eeebf5 100644 --- a/refilc_mobile_ui/lib/pages/home/home_page.dart +++ b/refilc_mobile_ui/lib/pages/home/home_page.dart @@ -317,6 +317,7 @@ class HomePageState extends State with TickerProviderStateMixin { badge: updateProvider.available, role: user.role, profilePictureString: user.picture, + gradeStreak: (user.gradeStreak ?? 0) > 1, ), ), ), diff --git a/refilc_mobile_ui/lib/pages/messages/messages_page.dart b/refilc_mobile_ui/lib/pages/messages/messages_page.dart index b36ea1c..c04485f 100644 --- a/refilc_mobile_ui/lib/pages/messages/messages_page.dart +++ b/refilc_mobile_ui/lib/pages/messages/messages_page.dart @@ -109,6 +109,7 @@ class MessagesPageState extends State badge: updateProvider.available, role: user.role, profilePictureString: user.picture, + gradeStreak: (user.gradeStreak ?? 0) > 1, ), ), ), diff --git a/refilc_mobile_ui/lib/pages/notes/notes_page.dart b/refilc_mobile_ui/lib/pages/notes/notes_page.dart index f777747..17ec4ea 100644 --- a/refilc_mobile_ui/lib/pages/notes/notes_page.dart +++ b/refilc_mobile_ui/lib/pages/notes/notes_page.dart @@ -315,6 +315,7 @@ class NotesPageState extends State with TickerProviderStateMixin { badge: updateProvider.available, role: user.role, profilePictureString: user.picture, + gradeStreak: (user.gradeStreak ?? 0) > 1, ), ), ), diff --git a/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart b/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart index 03b983a..9bb00ed 100644 --- a/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart +++ b/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart @@ -316,6 +316,7 @@ class TimetablePageState extends State badge: updateProvider.available, role: user.role, profilePictureString: user.picture, + gradeStreak: (user.gradeStreak ?? 0) > 1, ), ), ), diff --git a/refilc_mobile_ui/lib/screens/settings/settings_screen.dart b/refilc_mobile_ui/lib/screens/settings/settings_screen.dart index 35519be..7bb157d 100644 --- a/refilc_mobile_ui/lib/screens/settings/settings_screen.dart +++ b/refilc_mobile_ui/lib/screens/settings/settings_screen.dart @@ -27,6 +27,7 @@ import 'package:refilc_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu.dart import 'package:refilc_mobile_ui/common/panel/panel.dart'; import 'package:refilc_mobile_ui/common/panel/panel_button.dart'; import 'package:refilc_mobile_ui/common/profile_image/profile_image.dart'; +import 'package:refilc_mobile_ui/common/soon_alert/soon_alert.dart'; // import 'package:refilc_mobile_ui/common/soon_alert/soon_alert.dart'; import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart'; // import 'package:refilc_mobile_ui/common/system_chrome.dart'; @@ -320,6 +321,7 @@ class SettingsScreenState extends State badge: updateProvider.available, role: user.role, profilePictureString: user.picture, + gradeStreak: (user.gradeStreak ?? 0) > 1, backgroundColor: Theme.of(context) .colorScheme .tertiary, //!settings.presentationMode @@ -702,6 +704,46 @@ class SettingsScreenState extends State ], ), + if ((user.gradeStreak ?? 0) > 1) + SplittedPanel( + padding: const EdgeInsets.only( + bottom: 12.0, left: 24.0, right: 24.0), + children: [ + GestureDetector( + onTap: () { + SoonAlert.show(context: context); + }, + child: ListTile( + title: Text( + "grade_streak".i18n, + style: TextStyle( + color: AppColors.of(context).text.withOpacity(0.95), + fontWeight: FontWeight.w500, + ), + ), + subtitle: Text( + "grade_streak_subtitle".i18n, + style: TextStyle( + color: AppColors.of(context).text.withOpacity(0.75), + ), + ), + leading: const Text( + "🔥", + style: TextStyle(fontSize: 22.0), + ), + trailing: Text( + "${user.gradeStreak}", + style: TextStyle( + color: AppColors.of(context).text.withOpacity(0.95), + fontWeight: FontWeight.w500, + fontSize: 18.0, + ), + ), + ), + ), + ], + ), + // plus subscribe inline const PlusSettingsInline(), diff --git a/refilc_mobile_ui/lib/screens/settings/settings_screen.i18n.dart b/refilc_mobile_ui/lib/screens/settings/settings_screen.i18n.dart index dff0109..374f047 100644 --- a/refilc_mobile_ui/lib/screens/settings/settings_screen.i18n.dart +++ b/refilc_mobile_ui/lib/screens/settings/settings_screen.i18n.dart @@ -116,6 +116,9 @@ extension SettingsLocalization on String { "exp_settings": "Export Settings", "manage_subs": "Manage Subscription", "copy_plus_id": "Copy reFilc+ ID", + // grade streak + "grade_streak": "Grade 5 Streak", + "grade_streak_subtitle": "So many 5s in a row?!", }, "hu_hu": { "personal_details": "Személyes információk", @@ -230,6 +233,9 @@ extension SettingsLocalization on String { "exp_settings": "Beállítások exportálása", "manage_subs": "Előfizetés kezelése", "copy_plus_id": "reFilc+ ID másolása", + // grade streak + "grade_streak": "5-ös sorozat", + "grade_streak_subtitle": "Egymás után ennyi 5-ös?!", }, "de_de": { "personal_details": "Persönliche Angaben", @@ -344,6 +350,9 @@ extension SettingsLocalization on String { "exp_settings": "Einstellungen exportieren", "manage_subs": "Abonnement verwalten", "copy_plus_id": "reFilc+ ID kopieren", + // grade streak + "grade_streak": "5er-Streak", + "grade_streak_subtitle": "So viele 5er in Folge?!", }, };