2024-04-15 07:50:47 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
2026-08-11 14:41:12 +05:30
|
|
|
import 'package:immich_mobile/generated/translations.g.dart';
|
2024-05-02 15:59:14 -05:00
|
|
|
import 'package:immich_mobile/services/app_settings.service.dart';
|
2026-07-30 01:56:46 -07:00
|
|
|
import 'package:immich_mobile/utils/hooks/app_settings_update_hook.dart';
|
2026-01-19 14:56:35 -06:00
|
|
|
import 'package:immich_mobile/widgets/settings/setting_group_title.dart';
|
2024-05-06 23:04:21 -05:00
|
|
|
import 'package:immich_mobile/widgets/settings/settings_switch_list_tile.dart';
|
2024-04-15 07:50:47 +02:00
|
|
|
|
2026-08-05 01:26:49 +05:30
|
|
|
class HapticSetting extends HookWidget {
|
2025-07-29 00:34:03 +05:30
|
|
|
const HapticSetting({super.key});
|
2024-04-15 07:50:47 +02:00
|
|
|
|
|
|
|
|
@override
|
2026-08-05 01:26:49 +05:30
|
|
|
Widget build(BuildContext context) {
|
2025-07-25 08:07:22 +05:30
|
|
|
final hapticFeedbackSetting = useAppSettingsState(AppSettingsEnum.enableHapticFeedback);
|
|
|
|
|
final isHapticFeedbackEnabled = useValueNotifier(hapticFeedbackSetting.value);
|
2024-04-15 07:50:47 +02:00
|
|
|
|
2026-07-30 01:56:46 -07:00
|
|
|
void onHapticFeedbackChange(bool isEnabled) {
|
2024-04-15 07:50:47 +02:00
|
|
|
hapticFeedbackSetting.value = isEnabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
2026-08-11 14:41:12 +05:30
|
|
|
SettingGroupTitle(title: context.t.haptic_feedback_title, icon: Icons.vibration_outlined),
|
2024-04-15 07:50:47 +02:00
|
|
|
SettingsSwitchListTile(
|
|
|
|
|
valueNotifier: isHapticFeedbackEnabled,
|
2026-08-11 14:41:12 +05:30
|
|
|
title: context.t.enabled,
|
2024-04-15 07:50:47 +02:00
|
|
|
onChanged: onHapticFeedbackChange,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|