finished 5s streak thing

This commit is contained in:
Kima 2024-05-15 19:31:48 +02:00
parent 4dbe3d07a3
commit 8c118eedc1
10 changed files with 97 additions and 0 deletions

View File

@ -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(

View File

@ -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<ProfileImage> createState() => _ProfileImageState();
@ -145,6 +147,20 @@ class _ProfileImageState extends State<ProfileImage> {
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<ProfileImage> {
),
),
// 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,

View File

@ -169,6 +169,7 @@ class AbsencesPageState extends State<AbsencesPage>
badge: updateProvider.available,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,
),
),
),

View File

@ -566,6 +566,7 @@ class GradesPageState extends State<GradesPage> {
badge: updateProvider.available,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,
),
),
),

View File

@ -317,6 +317,7 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
badge: updateProvider.available,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,
),
),
),

View File

@ -109,6 +109,7 @@ class MessagesPageState extends State<MessagesPage>
badge: updateProvider.available,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,
),
),
),

View File

@ -315,6 +315,7 @@ class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
badge: updateProvider.available,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,
),
),
),

View File

@ -316,6 +316,7 @@ class TimetablePageState extends State<TimetablePage>
badge: updateProvider.available,
role: user.role,
profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1,
),
),
),

View File

@ -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<SettingsScreen>
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<SettingsScreen>
],
),
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(),

View File

@ -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?!",
},
};