Improve notifications, tilawah flow, and dzikir structure
This commit is contained in:
@@ -101,6 +101,11 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
||||
_saveSettings();
|
||||
}
|
||||
|
||||
void _resyncPrayerNotifications() {
|
||||
ref.invalidate(prayerTimesProvider);
|
||||
unawaited(ref.read(prayerTimesProvider.future));
|
||||
}
|
||||
|
||||
Future<void> _showQuietHoursDialog(BuildContext context) async {
|
||||
final startController =
|
||||
TextEditingController(text: _settings.quietHoursStart);
|
||||
@@ -236,6 +241,97 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showShalatReportDelayDialog(BuildContext context) async {
|
||||
final controller = TextEditingController(
|
||||
text: _settings.shalatReportReminderDelayMinutes.toString(),
|
||||
);
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('Jeda Pengingat Lapor Shalat'),
|
||||
content: TextField(
|
||||
controller: controller,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Menit setelah waktu shalat',
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx),
|
||||
child: const Text('Batal'),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
final value = int.tryParse(controller.text.trim());
|
||||
if (value == null || value < 5 || value > 240) return;
|
||||
_settings.shalatReportReminderDelayMinutes = value;
|
||||
_saveSettings();
|
||||
_resyncPrayerNotifications();
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
child: const Text('Simpan'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showShalatReportRepeatDialog(BuildContext context) async {
|
||||
final repeatController = TextEditingController(
|
||||
text: _settings.shalatReportReminderRepeatCount.toString(),
|
||||
);
|
||||
final intervalController = TextEditingController(
|
||||
text: _settings.shalatReportReminderRepeatIntervalMinutes.toString(),
|
||||
);
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('Pengulangan Pengingat Lapor'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
controller: repeatController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Jumlah ulang (0-5)',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TextField(
|
||||
controller: intervalController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Jeda antar ulang (menit)',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx),
|
||||
child: const Text('Batal'),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
final repeats = int.tryParse(repeatController.text.trim());
|
||||
final interval = int.tryParse(intervalController.text.trim());
|
||||
if (repeats == null || repeats < 0 || repeats > 5) return;
|
||||
if (interval == null || interval < 5 || interval > 180) return;
|
||||
_settings.shalatReportReminderRepeatCount = repeats;
|
||||
_settings.shalatReportReminderRepeatIntervalMinutes = interval;
|
||||
_saveSettings();
|
||||
_resyncPrayerNotifications();
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
child: const Text('Simpan'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
@@ -446,6 +542,46 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
_settingRow(
|
||||
isDark,
|
||||
icon: LucideIcons.siren,
|
||||
iconColor: const Color(0xFFC0392B),
|
||||
title: 'Pengingat Lapor Shalat',
|
||||
subtitle: _settings.shalatReportReminderEnabled
|
||||
? 'Aktif • ${_settings.shalatReportReminderDelayMinutes} menit setelah adzan'
|
||||
: 'Nonaktif',
|
||||
trailing: IosToggle(
|
||||
value: _settings.shalatReportReminderEnabled,
|
||||
onChanged: (v) {
|
||||
_settings.shalatReportReminderEnabled = v;
|
||||
_saveSettings();
|
||||
_resyncPrayerNotifications();
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
_settingRow(
|
||||
isDark,
|
||||
icon: LucideIcons.clock3,
|
||||
iconColor: const Color(0xFF16A085),
|
||||
title: 'Jeda Pengingat Lapor',
|
||||
subtitle:
|
||||
'${_settings.shalatReportReminderDelayMinutes} menit setelah waktu shalat',
|
||||
trailing: const Icon(LucideIcons.chevronRight, size: 20),
|
||||
onTap: () => _showShalatReportDelayDialog(context),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
_settingRow(
|
||||
isDark,
|
||||
icon: LucideIcons.repeat,
|
||||
iconColor: const Color(0xFF8E44AD),
|
||||
title: 'Ulangi Pengingat Lapor',
|
||||
subtitle:
|
||||
'${_settings.shalatReportReminderRepeatCount}x • tiap ${_settings.shalatReportReminderRepeatIntervalMinutes} menit',
|
||||
trailing: const Icon(LucideIcons.chevronRight, size: 20),
|
||||
onTap: () => _showShalatReportRepeatDialog(context),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
_settingRow(
|
||||
isDark,
|
||||
icon: LucideIcons.moonStar,
|
||||
@@ -521,6 +657,21 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
_settingRow(
|
||||
isDark,
|
||||
icon: LucideIcons.arrowRightCircle,
|
||||
iconColor: Colors.green,
|
||||
title: 'Lanjut Surah Otomatis',
|
||||
subtitle: 'Saat simpan sesi di ayat terakhir',
|
||||
trailing: IosToggle(
|
||||
value: _settings.tilawahAutoContinueNextSurah,
|
||||
onChanged: (v) {
|
||||
_settings.tilawahAutoContinueNextSurah = v;
|
||||
_saveSettings();
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
_settingRow(
|
||||
isDark,
|
||||
icon: LucideIcons.listChecks,
|
||||
|
||||
Reference in New Issue
Block a user