progress in quick settings

This commit is contained in:
Kima 2024-05-04 18:18:57 +02:00
parent 7edde06c11
commit 6b8708e1e3
3 changed files with 63 additions and 2 deletions

View File

@ -52,6 +52,9 @@ const settingsDB = DatabaseStruct("settings", {
"nav_shadow": int, "nav_shadow": int,
"new_colors": int, "new_colors": int,
"uwu_mode": 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 // DON'T FORGET TO UPDATE DEFAULT VALUES IN `initDB` MIGRATION OR ELSE PARENTS WILL COMPLAIN ABOUT THEIR CHILDREN MISSING
// YOU'VE BEEN WARNED!!! // YOU'VE BEEN WARNED!!!

View File

@ -12,6 +12,8 @@ import 'package:refilc_kreta_api/providers/timetable_provider.dart';
import 'package:refilc/api/providers/user_provider.dart'; import 'package:refilc/api/providers/user_provider.dart';
import 'package:refilc/theme/colors/colors.dart'; import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc_kreta_api/models/lesson.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/dot.dart';
import 'package:refilc_mobile_ui/common/empty.dart'; import 'package:refilc_mobile_ui/common/empty.dart';
import 'package:refilc_mobile_ui/common/profile_image/profile_button.dart'; import 'package:refilc_mobile_ui/common/profile_image/profile_button.dart';
@ -234,7 +236,7 @@ class TimetablePageState extends State<TimetablePage>
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor, surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
actions: [ actions: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
child: IconButton( child: IconButton(
splashRadius: 24.0, splashRadius: 24.0,
// tested timetable sync // tested timetable sync
@ -274,6 +276,30 @@ class TimetablePageState extends State<TimetablePage>
), ),
), ),
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<ThirdPartyProvider>(context,
// listen: false);
// await tpp.pushTimetable(context, _controller);
// },
onPressed: () {
showQuickOptions(context);
},
icon: Icon(FeatherIcons.menu,
color: AppColors.of(context).text),
),
),
// Profile Icon // Profile Icon
Padding( Padding(
padding: const EdgeInsets.only(right: 24.0), padding: const EdgeInsets.only(right: 24.0),
@ -817,6 +843,38 @@ class TimetablePageState extends State<TimetablePage>
), ),
); );
} }
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 // difference.inDays is not reliable

@ -1 +1 @@
Subproject commit 0d44954164c95333a9d538b0f1b9fefd6e38c842 Subproject commit 1f5cca7b8e2ac896155a6c494e79fb057628379e