mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 00:40:39 +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';
|
import 'package:vibration/vibration.dart';
|
||||||
|
|
||||||
class HapticsService {
|
class HapticsService {
|
||||||
|
@ -11,10 +13,17 @@ class HapticsService {
|
||||||
|
|
||||||
Future<void> _tryVibrate({required int duration, required int amplitude}) async {
|
Future<void> _tryVibrate({required int duration, required int amplitude}) async {
|
||||||
if (await _canVibrate()) {
|
if (await _canVibrate()) {
|
||||||
await Vibration.vibrate(
|
if (Platform.isAndroid) {
|
||||||
duration: duration,
|
await Vibration.vibrate(
|
||||||
amplitude: amplitude,
|
duration: duration,
|
||||||
);
|
amplitude: amplitude,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
await Vibration.vibrate(
|
||||||
|
pattern: [duration],
|
||||||
|
intensities: [amplitude],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue