haptics WOOOO
now it boops when you click either shock or vibrate
This commit is contained in:
parent
6a62a7c7f0
commit
3c26be0b35
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart'; // Import HapticFeedback
|
||||||
import 'package:OpenshockCompanion/settings_page.dart' show SettingsPage;
|
import 'package:OpenshockCompanion/settings_page.dart' show SettingsPage;
|
||||||
import 'package:OpenshockCompanion/api_handler.dart' show sendApiRequest;
|
import 'package:OpenshockCompanion/api_handler.dart' show sendApiRequest;
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
@ -97,6 +98,7 @@ class _SliderPageState extends State<SliderPage> {
|
||||||
if (intensityValue < 1 || timeValue < 1) {
|
if (intensityValue < 1 || timeValue < 1) {
|
||||||
// Display a warning, no need for a toast
|
// Display a warning, no need for a toast
|
||||||
} else {
|
} else {
|
||||||
|
HapticFeedback.vibrate(); // Add haptic feedback
|
||||||
sendApiRequest(intensityValue, timeValue, 1);
|
sendApiRequest(intensityValue, timeValue, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -109,6 +111,7 @@ class _SliderPageState extends State<SliderPage> {
|
||||||
if (intensityValue < 1 || timeValue < 1) {
|
if (intensityValue < 1 || timeValue < 1) {
|
||||||
// Display a warning, no need for a toast
|
// Display a warning, no need for a toast
|
||||||
} else {
|
} else {
|
||||||
|
HapticFeedback.vibrate(); // Add haptic feedback
|
||||||
sendApiRequest(intensityValue, timeValue, 2);
|
sendApiRequest(intensityValue, timeValue, 2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -131,7 +134,6 @@ class _SliderPageState extends State<SliderPage> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final ThemeData lightTheme = ThemeData(
|
final ThemeData lightTheme = ThemeData(
|
||||||
brightness: Brightness.light,
|
brightness: Brightness.light,
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
|
|
Loading…
Reference in a new issue