Masterarbeit Richard Stern. Flutter App, sich mit einem Bluetooth-Gerät verbindet und Berührungen auf einem Sensor visualisiert.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Vibrate
  2. [![pub package](https://img.shields.io/pub/v/vibrate.svg)](https://pub.dartlang.org/packages/vibrate)
  3. A Flutter plugin to vibrate the device.
  4. This uses all the current Haptic Feedback APIs from Apple and provides similar feedback on Android.
  5. ## Usage
  6. To use this plugin, add `vibrate` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).
  7. Make sure you add the following permissions to your Android Manifest
  8. ``` xml
  9. <uses-permission android:name="android.permission.VIBRATE"/>
  10. ```
  11. ## Usage
  12. ``` dart
  13. // Import package
  14. import 'package:vibrate/vibrate.dart';
  15. ```
  16. ### Vibration
  17. ``` dart
  18. // Check if the device can vibrate
  19. bool canVibrate = await Vibrate.canVibrate;
  20. // Vibrate
  21. // Vibration duration is a constant 500ms because
  22. // it cannot be set to a specific duration on iOS.
  23. Vibrate.vibrate();
  24. // Vibrate with pauses between each vibration
  25. final Iterable<Duration> pauses = [
  26. const Duration(milliseconds: 500),
  27. const Duration(milliseconds: 1000),
  28. const Duration(milliseconds: 500),
  29. ];
  30. // vibrate - sleep 0.5s - vibrate - sleep 1s - vibrate - sleep 0.5s - vibrate
  31. Vibrate.vibrateWithPauses(pauses);
  32. ```
  33. ### Haptic Feedback
  34. ``` dart
  35. // Choose from any of these available methods
  36. enum FeedbackType {
  37. success,
  38. error,
  39. warning,
  40. selection,
  41. impact,
  42. heavy,
  43. medium,
  44. light
  45. }
  46. var _type = FeedbackType.impact;
  47. Vibrate.feedback(_type);
  48. ```
  49. ## Documentation
  50. #### Android
  51. https://developer.android.com/reference/android/view/HapticFeedbackConstants
  52. #### iOS
  53. https://developer.apple.com/design/human-interface-guidelines/ios/user-interaction/feedback/