Skip to content

Commit

Permalink
merging PR and fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rodydavis committed Jun 24, 2021
1 parent 1daeac4 commit 4f9809a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 14 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: github pages

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
channel: 'dev'

- name: Install
run: |
flutter config --enable-web
flutter pub get
- name: Build
run: cd example && flutter build web

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./example/build/web
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.0

* Merging changes and fixing lint errors

## 1.0.0

* Changing Name
Expand Down
16 changes: 8 additions & 8 deletions lib/flutter_vibrate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ enum FeedbackType {
}

class Vibrate {
static const MethodChannel _channel = const MethodChannel('vibrate');
static const MethodChannel _channel = MethodChannel('vibrate');
static const Duration _DEFAULT_VIBRATION_DURATION =
const Duration(milliseconds: 500);
Duration(milliseconds: 500);

/// Vibrate for 500ms on Android, and for the default time on iOS (about 500ms as well)
static Future vibrate() => _channel.invokeMethod(
'vibrate', {"duration": _DEFAULT_VIBRATION_DURATION.inMilliseconds});
'vibrate', {'duration': _DEFAULT_VIBRATION_DURATION.inMilliseconds});

/// Whether the device can actually vibrate or not
static Future<bool> get canVibrate async {
Expand Down Expand Up @@ -63,13 +63,13 @@ class Vibrate {
/// and once after the last pause
static Future vibrateWithPauses(Iterable<Duration> pauses) async {
for (Duration d in pauses) {
vibrate();
for (final Duration d in pauses) {
await vibrate();
//Because the native vibration is not awaited, we need to wait for
//the vibration to end before launching another one
await new Future.delayed(_DEFAULT_VIBRATION_DURATION);
await new Future.delayed(d);
await Future.delayed(_DEFAULT_VIBRATION_DURATION);
await Future.delayed(d);
}
vibrate();
await vibrate();
}
}
18 changes: 12 additions & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
name: flutter_vibrate
description: A Haptic Feedback plugin.
version: 1.0.0
version: 1.1.0
environment:
sdk: ">=2.12.0 <3.0.0"
sdk: '>=2.12.0-259.8.beta <3.0.0'
flutter: ^1.10.0
authors:
- Clovis Nicolas <clovisnicolas0@gmail.com>
- Rhodes Davis Jr. <rody.davis.jr@gmail.com>
- GiKode <827266641@qq.com>
homepage: https://github.com/rodydavis/flutter_vibrate
maintainer: Rody Davis (@rodydavis)
homepage: https://github.com/rodydavis/plugins
repository: https://github.com/rodydavis/flutter_vibrate

dependencies:
flutter:
sdk: flutter

flutter:
plugin:
androidPackage: flutter.plugins.vibrate
pluginClass: VibratePlugin

platforms:
android:
package: flutter.plugins.vibrate
pluginClass: VibratePlugin
ios:
pluginClass: VibratePlugin

0 comments on commit 4f9809a

Please sign in to comment.