things™️

This commit is contained in:
Kima 2024-06-18 14:44:53 +02:00
parent 92f16e054d
commit b5b0046ef5
5 changed files with 151 additions and 22 deletions

View File

@ -60,7 +60,7 @@ class TodoItem {
);
}
get toJson => {
Map<String, dynamic> get toJson => {
'id': id,
'title': title,
'content': content,

View File

@ -88,6 +88,7 @@ class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
// todo tiles
List<Widget> toDoTiles = [];
// TODO: FIX THIS ASAP
if (hw.isNotEmpty &&
Provider.of<PlusProvider>(context, listen: false)
.hasScope(PremiumScopes.unlimitedSelfNotes)) {
@ -98,13 +99,23 @@ class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
'${(e.subject.isRenamed ? e.subject.renamedTo : e.subject.name) ?? ''}, ${e.content.escapeHtml()}',
isTicked: doneItems[e.id] ?? false,
onTap: (p0) async {
print(p0);
print(doneItems);
if (!doneItems.containsKey(e.id)) {
doneItems.addAll({e.id: p0});
} else {
doneItems[e.id] = p0;
}
print(doneItems);
print(doneItems[e.id]);
print(user.id);
await databaseProvider.userStore
.storeToDoItem(doneItems, userId: user.id!);
setState(() {});
print(
await databaseProvider.userQuery.toDoItems(userId: user.id!));
},
)));
}
@ -116,10 +127,20 @@ class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
description: e.content,
isTicked: e.done,
onTap: (p0) async {
todoItems.firstWhere((element) => element.id == e.id).done = p0;
final todoItemIndex =
todoItems.indexWhere((element) => element.id == e.id);
if (todoItemIndex != -1) {
TodoItem todoItem = todoItems[todoItemIndex];
Map<String, dynamic> todoItemJson = todoItem.toJson;
todoItemJson['done'] = p0;
todoItem = TodoItem.fromJson(todoItemJson);
todoItems[todoItemIndex] = todoItem;
await databaseProvider.userStore
.storeSelfTodoItems(todoItems, userId: user.id!);
}
await databaseProvider.userStore
.storeSelfTodoItems(todoItems, userId: user.id!);
// await databaseProvider.userStore
// .storeSelfTodoItems(todoItems, userId: user.id!);
},
)));
}
@ -468,13 +489,13 @@ class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
],
),
onTap: () {
if (!Provider.of<PlusProvider>(context, listen: false)
.hasScope(PremiumScopes.unlimitedSelfNotes)) {
PlusLockedFeaturePopup.show(
context: context, feature: PremiumFeature.selfNotes);
// if (!Provider.of<PlusProvider>(context, listen: false)
// .hasScope(PremiumScopes.unlimitedSelfNotes)) {
// PlusLockedFeaturePopup.show(
// context: context, feature: PremiumFeature.selfNotes);
return;
}
// return;
// }
showTaskCreation(context);
},

View File

@ -128,13 +128,34 @@ class SettingsHelper {
// }
// }
static void fontFamily(BuildContext context) {
static void fontFamily(BuildContext context,
{required Function() showDialog}) {
SettingsProvider settings =
Provider.of<SettingsProvider>(context, listen: false);
showBottomSheetMenu(
context,
items: List.generate(fontList.length, (index) {
// if (index == fontList.length) {
// return BottomSheetMenuItem(
// onPressed: showDialog,
// title: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// SettingsLocalization('custom').i18n,
// ),
// if (fontList.contains(settings.fontFamily) == false &&
// settings.fontFamily != '')
// Icon(
// Icons.check_circle,
// color: Theme.of(context).colorScheme.secondary,
// ),
// ],
// ),
// );
// }
String font = fontList[index];
return BottomSheetMenuItem(
onPressed: () {

View File

@ -5,7 +5,8 @@ extension SettingsLocalization on String {
{
"en_en": {
"heads_up": "Heads up!",
"export_warning": "Exported grades are currently not yet viewable in reFilc, you'll only be able to view them manually in JSON format. In the future, this functionality will be extended and you will be able to view the tickets in the app interface.",
"export_warning":
"Exported grades are currently not yet viewable in reFilc, you'll only be able to view them manually in JSON format. In the future, this functionality will be extended and you will be able to view the tickets in the app interface.",
"personal_details": "Personal Details",
"open_dkt": "Open DCS",
"edit_nickname": "Edit Nickname",
@ -126,10 +127,12 @@ extension SettingsLocalization on String {
"new_popups": "New Popups",
"export_method": "Export Method",
"grade_exporting": "Grade Exporting",
"custom": "Custom",
},
"hu_hu": {
"heads_up": "Figyelem!",
"export_warning": "Az exportált jegyek jelenleg még nem megtekinthetők a reFilc-ben, csak te magad tudod átnézni őket JSON formátumban. A jövőben ez a funkció bővülni fog, és a jegyeket meg is tekintheted majd a reFilc felületén.",
"export_warning":
"Az exportált jegyek jelenleg még nem megtekinthetők a reFilc-ben, csak te magad tudod átnézni őket JSON formátumban. A jövőben ez a funkció bővülni fog, és a jegyeket meg is tekintheted majd a reFilc felületén.",
"personal_details": "Személyes információk",
"open_dkt": "DKT megnyitása",
"edit_nickname": "Becenév szerkesztése",
@ -250,10 +253,12 @@ extension SettingsLocalization on String {
"new_popups": "Új felugró ablakok",
"export_method": "Exportálási mód",
"grade_exporting": "Jegy exportálás",
"custom": "Egyedi",
},
"de_de": {
"heads_up": "Achtung!",
"export_warning": "Exportierte Tickets sind derzeit noch nicht in reFilc einsehbar, Sie können sie nur selbst im JSON- Format überprüfen. In Zukunft wird diese Funktionalität erweitert und Sie werden die Tickets in der reFilc-Oberfläche anzeigen können",
"export_warning":
"Exportierte Tickets sind derzeit noch nicht in reFilc einsehbar, Sie können sie nur selbst im JSON- Format überprüfen. In Zukunft wird diese Funktionalität erweitert und Sie werden die Tickets in der reFilc-Oberfläche anzeigen können",
"personal_details": "Persönliche Angaben",
"open_dkt": "Öffnen RDZ",
"edit_nickname": "Spitznamen bearbeiten",
@ -374,6 +379,7 @@ extension SettingsLocalization on String {
"new_popups": "Neue Popups",
"export_method": "Exportmethode",
"grade_exporting": "Noten exportieren",
"custom": "Benutzerdefiniert",
},
};

View File

@ -79,6 +79,8 @@ class PersonalizeSettingsScreenState extends State<PersonalizeSettingsScreen>
late AnimationController _hideContainersController;
final TextEditingController _customFontFamily = TextEditingController();
late List<Grade> editedShit;
late List<Grade> otherShit;
@ -927,15 +929,94 @@ class PersonalizeSettingsScreenState extends State<PersonalizeSettingsScreen>
children: [
PanelButton(
onPressed: () {
if (!Provider.of<PlusProvider>(context, listen: false)
.hasScope(PremiumScopes.customFont)) {
PlusLockedFeaturePopup.show(
context: context,
feature: PremiumFeature.fontChange);
return;
}
// if (!Provider.of<PlusProvider>(context, listen: false)
// .hasScope(PremiumScopes.customFont)) {
// PlusLockedFeaturePopup.show(
// context: context,
// feature: PremiumFeature.fontChange);
// return;
// }
SettingsHelper.fontFamily(context);
SettingsHelper.fontFamily(
context,
showDialog: () => showDialog(
context: context,
builder: (context) => AlertDialog(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(14.0))),
contentPadding:
const EdgeInsets.only(top: 10.0),
title: Text("custom".i18n),
content: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 24.0, vertical: 10.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextField(
controller: _customFontFamily,
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.grey, width: 1.5),
borderRadius:
BorderRadius.circular(12.0),
),
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.grey, width: 1.5),
borderRadius:
BorderRadius.circular(12.0),
),
contentPadding:
const EdgeInsets.symmetric(
horizontal: 12.0),
hintText: "ff_name".i18n,
suffixIcon: IconButton(
icon: const Icon(
FeatherIcons.x,
color: Colors.grey,
),
onPressed: () {
setState(() {
_customFontFamily.text = "";
});
},
),
),
),
],
),
),
actions: [
TextButton(
child: Text(
"cancel".i18n,
style: const TextStyle(
fontWeight: FontWeight.w500),
),
onPressed: () {
Navigator.of(context).maybePop();
},
),
TextButton(
child: Text(
"next".i18n,
style: const TextStyle(
fontWeight: FontWeight.w500),
),
onPressed: () async {
settingsProvider.update(
fontFamily: _customFontFamily.text);
Navigator.of(context).pop(true);
},
),
],
),
),
);
setState(() {});
},
title: Text(