Skip to content

Commit

Permalink
feat: use icons in settings to better explain the options
Browse files Browse the repository at this point in the history
  • Loading branch information
user5522 committed Aug 7, 2024
1 parent 8c923ae commit c81244f
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 7 deletions.
42 changes: 36 additions & 6 deletions lib/components/settings/customize_timetable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,71 @@ class CustomizeTimetableOptions extends ConsumerWidget {
return Column(
children: [
ListTile(
leading: const Icon(
Icons.table_chart_outlined,
size: 20,
),
horizontalTitleGap: 8,
title: DefaultViewOptions(
settings: settings,
defaultTimetableView: defaultTimetableView,
),
onTap: () {},
),
SwitchListTile(
secondary: const Icon(
Icons.close_fullscreen_outlined,
size: 20,
),
visualDensity: const VisualDensity(horizontal: -4),
title: const Text("compact_mode").tr(),
value: compactMode,
onChanged: (bool value) {
settings.updateCompactMode(value);
},
),
SwitchListTile(
title: const Text("hide_locations").tr(),
value: hideLocation,
secondary: const Icon(
Icons.title_outlined,
size: 20,
),
visualDensity: const VisualDensity(horizontal: -4),
title: const Text("single_letter_days").tr(),
value: singleLetterDays,
onChanged: (bool value) {
settings.updateHideLocation(value);
settings.updateSingleLetterDays(value);
},
),
SwitchListTile(
title: const Text("single_letter_days").tr(),
value: singleLetterDays,
secondary: const Icon(
Icons.location_off_outlined,
size: 20,
),
visualDensity: const VisualDensity(horizontal: -4),
title: const Text("hide_locations").tr(),
value: hideLocation,
onChanged: (bool value) {
settings.updateSingleLetterDays(value);
settings.updateHideLocation(value);
},
),
SwitchListTile(
secondary: const Icon(
Icons.visibility_off_outlined,
size: 20,
),
visualDensity: const VisualDensity(horizontal: -4),
title: const Text("hide_sunday").tr(),
value: hideSunday,
onChanged: (bool value) {
settings.updateHideSunday(value);
},
),
SwitchListTile(
secondary: const Icon(
Icons.visibility_off_outlined,
size: 20,
),
visualDensity: const VisualDensity(horizontal: -4),
title: const Text("hide_transparent_subjects").tr(),
value: hideTransparentSubject,
onChanged: (bool value) {
Expand Down
21 changes: 21 additions & 0 deletions lib/components/settings/general.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,22 @@ class GeneralOptions extends ConsumerWidget {
return Column(
children: [
ListTile(
leading: const Icon(
Icons.translate,
size: 20,
),
horizontalTitleGap: 8,
title: LanguageOptions(
language: language,
),
onTap: () {},
),
ListTile(
leading: const Icon(
Icons.palette_outlined,
size: 20,
),
horizontalTitleGap: 8,
title: ThemeOptions(
theme: theme,
),
Expand All @@ -46,6 +56,12 @@ class GeneralOptions extends ConsumerWidget {

if (version != null && version >= 31) {
return SwitchListTile(
secondary: const Icon(
Icons.wallpaper_outlined,
size: 20,
),
// this is dumb.. I couldn't find a better way to change the gap size on switch list tiles
visualDensity: const VisualDensity(horizontal: -4),
title: const Text("monet_theming").tr(),
subtitle: const Text("Android 12+"),
value: monetTheming,
Expand All @@ -59,6 +75,11 @@ class GeneralOptions extends ConsumerWidget {
),
ListTile(
enabled: !monetTheming,
leading: const Icon(
Icons.colorize_outlined,
size: 20,
),
horizontalTitleGap: 8,
title: Row(
children: [
const Text("app_color").tr(),
Expand Down
10 changes: 10 additions & 0 deletions lib/components/settings/screens/timetable_management.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,23 @@ class TimetableManagementScreen extends ConsumerWidget {
Column(
children: [
SwitchListTile(
secondary: const Icon(
Icons.backup_table_outlined,
size: 20,
),
visualDensity: const VisualDensity(horizontal: -4),
title: const Text("multiple_timetables").tr(),
value: multipleTimetables,
onChanged: (bool value) {
settings.updateMultipleTimetables(value);
},
),
ListTile(
leading: const Icon(
Icons.delete_forever_outlined,
size: 20,
),
horizontalTitleGap: 8,
title: const Text("reset").tr(),
onTap: () {
showDialog<void>(
Expand Down
20 changes: 20 additions & 0 deletions lib/components/settings/screens/timetable_period.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ class TimetablePeriodScreen extends ConsumerWidget {
Column(
children: [
SwitchListTile(
secondary: const Icon(
Icons.edit_outlined,
size: 20,
),
visualDensity: const VisualDensity(horizontal: -4),
title: const Text("custom_time_period").tr(),
value: customTimePeriod,
onChanged: (bool value) {
Expand All @@ -95,6 +100,11 @@ class TimetablePeriodScreen extends ConsumerWidget {
},
),
SwitchListTile(
secondary: const Icon(
Icons.schedule_outlined,
size: 20,
),
visualDensity: const VisualDensity(horizontal: -4),
title: const Text("24_hour_period").tr(),
value: twentyFourHours,
onChanged: (bool value) {
Expand All @@ -111,6 +121,11 @@ class TimetablePeriodScreen extends ConsumerWidget {
textColor: Theme.of(context).colorScheme.primary,
),
ListTile(
leading: const Icon(
Icons.play_arrow_outlined,
size: 20,
),
horizontalTitleGap: 8,
title: const Text("start_time").tr(),
enabled: customTimePeriod ? true : false,
subtitle: Text(getTime(customStartTime)),
Expand All @@ -135,6 +150,11 @@ class TimetablePeriodScreen extends ConsumerWidget {
},
),
ListTile(
leading: const Icon(
Icons.stop_outlined,
size: 20,
),
horizontalTitleGap: 8,
title: const Text("end_time").tr(),
enabled: customTimePeriod ? true : false,
subtitle: Text(getTime(customEndTime)),
Expand Down
15 changes: 15 additions & 0 deletions lib/components/settings/timetable_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ class TimetableDataOptions extends ConsumerWidget {
return Column(
children: [
ListTile(
leading: const Icon(
Icons.file_download_outlined,
size: 20,
),
horizontalTitleGap: 8,
onTap: () {
final ScaffoldFeatureController<SnackBar, SnackBarClosedReason>
snackBar = ScaffoldMessenger.of(context).showSnackBar(
Expand All @@ -34,6 +39,11 @@ class TimetableDataOptions extends ConsumerWidget {
title: const Text("create_backup").tr(),
),
ListTile(
leading: const Icon(
Icons.file_upload_outlined,
size: 20,
),
horizontalTitleGap: 8,
onTap: () async {
showDialog<void>(
context: context,
Expand Down Expand Up @@ -61,6 +71,11 @@ class TimetableDataOptions extends ConsumerWidget {
title: const Text("restore_backup").tr(),
),
ListTile(
leading: const Icon(
Icons.delete_forever_outlined,
size: 20,
),
horizontalTitleGap: 8,
onTap: () {
showDialog<void>(
context: context,
Expand Down
22 changes: 21 additions & 1 deletion lib/components/settings/timetable_features.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class TimetableFeaturesOptions extends ConsumerWidget {
return Column(
children: [
ListTile(
leading: const Icon(
Icons.schedule_outlined,
size: 20,
),
horizontalTitleGap: 8,
title: const Text("timetable_period_config").tr(),
onTap: () {
Navigator.push(
context,
Expand All @@ -26,9 +32,13 @@ class TimetableFeaturesOptions extends ConsumerWidget {
),
);
},
title: const Text("timetable_period_config").tr(),
),
ListTile(
leading: const Icon(
Icons.table_view_outlined,
size: 20,
),
horizontalTitleGap: 8,
onTap: () {
Navigator.push(
context,
Expand All @@ -40,13 +50,23 @@ class TimetableFeaturesOptions extends ConsumerWidget {
title: const Text("manage_timetables").tr(),
),
SwitchListTile(
secondary: const Icon(
Icons.rotate_90_degrees_ccw_outlined,
size: 20,
),
visualDensity: const VisualDensity(horizontal: -4),
title: const Text("rotation_week").plural(2),
value: rotationWeeks,
onChanged: (bool value) {
settings.updateRotationWeeks(value);
},
),
SwitchListTile(
secondary: const Icon(
Icons.format_color_fill_outlined,
size: 20,
),
visualDensity: const VisualDensity(horizontal: -4),
title: const Text("auto_complete_colors").tr(),
subtitle: const Text("auto_complete_colors_description").tr(),
value: autoCompleteColor,
Expand Down

0 comments on commit c81244f

Please sign in to comment.