mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20: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()) {
|
||||||
|
if (Platform.isAndroid) {
|
||||||
await Vibration.vibrate(
|
await Vibration.vibrate(
|
||||||
duration: duration,
|
duration: duration,
|
||||||
amplitude: amplitude,
|
amplitude: amplitude,
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
await Vibration.vibrate(
|
||||||
|
pattern: [duration],
|
||||||
|
intensities: [amplitude],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue