From 6b8708e1e3ca63d5d8035837a0975190c3296a5f Mon Sep 17 00:00:00 2001 From: Kima Date: Sat, 4 May 2024 18:18:57 +0200 Subject: [PATCH] progress in quick settings --- refilc/lib/database/init.dart | 3 + .../lib/pages/timetable/timetable_page.dart | 60 ++++++++++++++++++- refilc_plus | 2 +- 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/refilc/lib/database/init.dart b/refilc/lib/database/init.dart index d06a600..23960a9 100644 --- a/refilc/lib/database/init.dart +++ b/refilc/lib/database/init.dart @@ -52,6 +52,9 @@ const settingsDB = DatabaseStruct("settings", { "nav_shadow": int, "new_colors": int, "uwu_mode": int, + // quick settings + "q_timetable_lesson_num": int, "q_timetable_sub_tiles": int, + "q_subjects_sub_tiles": int, }); // DON'T FORGET TO UPDATE DEFAULT VALUES IN `initDB` MIGRATION OR ELSE PARENTS WILL COMPLAIN ABOUT THEIR CHILDREN MISSING // YOU'VE BEEN WARNED!!! diff --git a/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart b/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart index f4bb86b..da4976b 100644 --- a/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart +++ b/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart @@ -12,6 +12,8 @@ import 'package:refilc_kreta_api/providers/timetable_provider.dart'; import 'package:refilc/api/providers/user_provider.dart'; import 'package:refilc/theme/colors/colors.dart'; import 'package:refilc_kreta_api/models/lesson.dart'; +import 'package:refilc_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu.dart'; +import 'package:refilc_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu_item.dart'; import 'package:refilc_mobile_ui/common/dot.dart'; import 'package:refilc_mobile_ui/common/empty.dart'; import 'package:refilc_mobile_ui/common/profile_image/profile_button.dart'; @@ -234,7 +236,7 @@ class TimetablePageState extends State surfaceTintColor: Theme.of(context).scaffoldBackgroundColor, actions: [ Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), child: IconButton( splashRadius: 24.0, // tested timetable sync @@ -274,6 +276,30 @@ class TimetablePageState extends State ), ), + Padding( + padding: const EdgeInsets.only( + right: 8.0, + bottom: 8.0, + top: 8.0, + ), + child: IconButton( + splashRadius: 24.0, + // tested timetable sync + // onPressed: () async { + // ThirdPartyProvider tpp = + // Provider.of(context, + // listen: false); + + // await tpp.pushTimetable(context, _controller); + // }, + onPressed: () { + showQuickOptions(context); + }, + icon: Icon(FeatherIcons.menu, + color: AppColors.of(context).text), + ), + ), + // Profile Icon Padding( padding: const EdgeInsets.only(right: 24.0), @@ -817,6 +843,38 @@ class TimetablePageState extends State ), ); } + + void showQuickOptions(BuildContext context) { + showBottomSheetMenu( + context, + items: [ + SwitchListTile( + title: Text( + 'show_lesson_num'.i18n, + ), + value: settingsProvider.qTimetableLessonNum, + onChanged: (v) { + settingsProvider.update(qTimetableLessonNum: v); + setState(() {}); + + Navigator.of(context).maybePop(); + }, + ), + SwitchListTile( + title: Text( + 'show_exams_and_homework'.i18n, + ), + value: settingsProvider.qTimetableSubTiles, + onChanged: (v) { + settingsProvider.update(qTimetableSubTiles: v); + setState(() {}); + + Navigator.of(context).maybePop(); + }, + ), + ], + ); + } } // difference.inDays is not reliable diff --git a/refilc_plus b/refilc_plus index 0d44954..1f5cca7 160000 --- a/refilc_plus +++ b/refilc_plus @@ -1 +1 @@ -Subproject commit 0d44954164c95333a9d538b0f1b9fefd6e38c842 +Subproject commit 1f5cca7b8e2ac896155a6c494e79fb057628379e