Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nohli/haptic_feedback
https://github.com/nohli/haptic_feedback
android dart flutter hacktoberfest haptic-feedback haptics ios
Last synced: 19 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nohli/haptic_feedback
- Owner: nohli
- License: bsd-3-clause
- Created: 2023-08-13T12:07:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-30T05:39:57.000Z (3 months ago)
- Last Synced: 2024-10-12T05:44:09.414Z (about 1 month ago)
- Topics: android, dart, flutter, hacktoberfest, haptic-feedback, haptics, ios
- Language: Dart
- Homepage: https://pub.dev/packages/haptic_feedback
- Size: 201 KB
- Stars: 12
- Watchers: 1
- Forks: 7
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# haptic_feedback
A haptic feedback plugin for both iOS and Android.
While it utilizes [standard iOS haptics](https://developer.apple.com/design/human-interface-guidelines/playing-haptics#iOS), it aims to emulate these same haptic patterns on Android for a consistent experience across platforms.
For more information on using the package in your Flutter app, you can read the article [Using haptic feedback to make your Flutter app more interactive](https://fluttercraftedbetter.com/posts/using-haptic-feedback-to-make-your-flutter-app-more-interactive) by Kamran. He provides detailed explanations on haptic feedback and when to use each type.
## Getting Started
### 1. Add the dependency
```shell
flutter pub add haptic_feedback
```### 2. Use the plugin
```dart
final canVibrate = await Haptics.canVibrate();await Haptics.vibrate(HapticsType.success);
await Haptics.vibrate(HapticsType.warning);
await Haptics.vibrate(HapticsType.error);await Haptics.vibrate(HapticsType.light);
await Haptics.vibrate(HapticsType.medium);
await Haptics.vibrate(HapticsType.heavy);await Haptics.vibrate(HapticsType.rigid);
await Haptics.vibrate(HapticsType.soft);await Haptics.vibrate(HapticsType.selection);
```## Automatic Permissions Inclusion
### Android VIBRATE Permission
When you integrate the `haptic_feedback` plugin into your Flutter project, it will automatically include the necessary `VIBRATE` permission in the final merged `AndroidManifest.xml` of your app. This is due to the permission being declared in the plugin's manifest.
#### What this means for you:
- **No Manual Action Required**: You don't have to add the `` permission to your app's `AndroidManifest.xml` manually. It will be automatically merged when building the app.
- **Transparency**: By using the `haptic_feedback` plugin, your app will request the `VIBRATE` permission. Ensure that you are aware of all permissions your app requires, especially if you publish it on app stores. Some users may be sensitive to app permissions, even if they don't require explicit consent.
- **Permission Overview**: To review all permissions that your app requests due to plugins and your own declarations, inspect the [final merged](https://stackoverflow.com/questions/74025731/where-is-the-merged-manifest-in-flutter-project) `AndroidManifest.xml` after a build. This will provide a comprehensive view of all permissions and other manifest entries.