mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 15:00:40 +00:00
[iOS] fixed vibration
This commit is contained in:
parent
f307676ca5
commit
d631f41589
1 changed files with 13 additions and 4 deletions
|
@ -1,3 +1,5 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:vibration/vibration.dart';
|
||||
|
||||
class HapticsService {
|
||||
|
@ -11,10 +13,17 @@ class HapticsService {
|
|||
|
||||
Future<void> _tryVibrate({required int duration, required int amplitude}) async {
|
||||
if (await _canVibrate()) {
|
||||
await Vibration.vibrate(
|
||||
duration: duration,
|
||||
amplitude: amplitude,
|
||||
);
|
||||
if (Platform.isAndroid) {
|
||||
await Vibration.vibrate(
|
||||
duration: duration,
|
||||
amplitude: amplitude,
|
||||
);
|
||||
} else {
|
||||
await Vibration.vibrate(
|
||||
pattern: [duration],
|
||||
intensities: [amplitude],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue