haptics WOOOO

now it boops when you click either shock or vibrate
This commit is contained in:
Mercurio 2023-11-09 21:51:56 +01:00
parent 6a62a7c7f0
commit 3c26be0b35

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; // Import HapticFeedback
import 'package:OpenshockCompanion/settings_page.dart' show SettingsPage;
import 'package:OpenshockCompanion/api_handler.dart' show sendApiRequest;
import 'package:shared_preferences/shared_preferences.dart';
@ -97,6 +98,7 @@ class _SliderPageState extends State<SliderPage> {
if (intensityValue < 1 || timeValue < 1) {
// Display a warning, no need for a toast
} else {
HapticFeedback.vibrate(); // Add haptic feedback
sendApiRequest(intensityValue, timeValue, 1);
}
},
@ -109,6 +111,7 @@ class _SliderPageState extends State<SliderPage> {
if (intensityValue < 1 || timeValue < 1) {
// Display a warning, no need for a toast
} else {
HapticFeedback.vibrate(); // Add haptic feedback
sendApiRequest(intensityValue, timeValue, 2);
}
},
@ -131,7 +134,6 @@ class _SliderPageState extends State<SliderPage> {
}
}
final ThemeData lightTheme = ThemeData(
brightness: Brightness.light,
useMaterial3: true,