Skip to content

Commit b328eda

Browse files
committed
feat(ui): Buat pengaturan play sound pada notifikasi screenshot
1 parent c458f37 commit b328eda

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

lib/core/util/shared_preferences_manager.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class SharedPreferencesManager {
2323
static const keyFinishTimeReminderTrack = 'finish_time_reminder_track';
2424
static const keyDayReminderTrack = 'day_reminder_track';
2525
static const keyIntervalReminderTrack = 'interval_reminder_track';
26+
static const keyIsEnableSoundScreenshotNotification = 'is_enable_sound_screenshot_notification';
2627

2728
SharedPreferencesManager();
2829

lib/feature/presentation/page/setting/setting_page.dart

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class _SettingPageState extends State<SettingPage> {
3838
final navigationRailDestinations = <NavigationRailDestination>[];
3939
final sharedPreferencesManager = sl<SharedPreferencesManager>();
4040
final valueNotifierIsEnableScreenshotNotification = ValueNotifier(false);
41+
final valueNotifierIsEnableSoundScreenshotNotification = ValueNotifier(true);
4142
final valueNotifierAppearanceMode = ValueNotifier(AppearanceMode.light);
4243
final valueNotifierLaunchAtStartup = ValueNotifier(true);
4344
final valueNotifierAlwaysOnTop = ValueNotifier(true);
@@ -258,6 +259,7 @@ class _SettingPageState extends State<SettingPage> {
258259
),
259260
children: [
260261
buildWidgetScreenshotNotification(),
262+
buildWidgetPlaySoundScreenshotNotification(),
261263
const SizedBox(height: 16),
262264
buildWidgetReminderNotTrackNotification(),
263265
const SizedBox(height: 8),
@@ -686,6 +688,8 @@ class _SettingPageState extends State<SettingPage> {
686688
void prepareData() {
687689
valueNotifierIsEnableScreenshotNotification.value =
688690
sharedPreferencesManager.getBool(SharedPreferencesManager.keyIsEnableScreenshotNotification) ?? false;
691+
valueNotifierIsEnableSoundScreenshotNotification.value =
692+
sharedPreferencesManager.getBool(SharedPreferencesManager.keyIsEnableSoundScreenshotNotification) ?? false;
689693
valueNotifierAlwaysOnTop.value =
690694
sharedPreferencesManager.getBool(SharedPreferencesManager.keyIsAlwaysOnTop, defaultValue: true) ?? true;
691695

@@ -1072,6 +1076,37 @@ class _SettingPageState extends State<SettingPage> {
10721076
);
10731077
}
10741078

1079+
Widget buildWidgetPlaySoundScreenshotNotification() {
1080+
return Row(
1081+
children: [
1082+
SizedBox(
1083+
width: 24,
1084+
child: ValueListenableBuilder(
1085+
valueListenable: valueNotifierIsEnableSoundScreenshotNotification,
1086+
builder: (BuildContext context, bool isEnable, _) {
1087+
return Checkbox(
1088+
value: isEnable,
1089+
onChanged: (newValue) {
1090+
if (newValue != null) {
1091+
valueNotifierIsEnableSoundScreenshotNotification.value = newValue;
1092+
sharedPreferencesManager.putBool(
1093+
SharedPreferencesManager.keyIsEnableSoundScreenshotNotification,
1094+
newValue,
1095+
);
1096+
}
1097+
},
1098+
);
1099+
},
1100+
),
1101+
),
1102+
const SizedBox(width: 4),
1103+
Text(
1104+
'play_sound'.tr(),
1105+
),
1106+
],
1107+
);
1108+
}
1109+
10751110
Widget buildWidgetMember() {
10761111
return Row(
10771112
crossAxisAlignment: CrossAxisAlignment.start,

0 commit comments

Comments
 (0)