diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json new file mode 100644 index 0000000..bf0c1f1 --- /dev/null +++ b/.dart_tool/package_config.json @@ -0,0 +1,16 @@ +{ + "configVersion": 2, + "packages": [ + { + "name": "packages_dart_rodydavis", + "rootUri": "../", + "packageUri": "lib/", + "languageVersion": "3.5" + } + ], + "generator": "pub", + "generatorVersion": "3.10.4", + "flutterRoot": "file:///opt/homebrew/Caskroom/flutter/2.10.4/flutter", + "flutterVersion": "3.38.5", + "pubCache": "file:///Users/rodydavis/.pub-cache" +} diff --git a/.dart_tool/package_graph.json b/.dart_tool/package_graph.json new file mode 100644 index 0000000..c67f140 --- /dev/null +++ b/.dart_tool/package_graph.json @@ -0,0 +1,14 @@ +{ + "roots": [ + "packages_dart_rodydavis" + ], + "packages": [ + { + "name": "packages_dart_rodydavis", + "version": "0.0.0", + "dependencies": [], + "devDependencies": [] + } + ], + "configVersion": 1 +} \ No newline at end of file diff --git a/packages/flutter_vibrate/.github/workflows/main.yml b/packages/flutter_vibrate/.github/workflows/main.yml new file mode 100644 index 0000000..1c693cc --- /dev/null +++ b/packages/flutter_vibrate/.github/workflows/main.yml @@ -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 diff --git a/packages/flutter_vibrate/.gitignore b/packages/flutter_vibrate/.gitignore new file mode 100644 index 0000000..02d7df3 --- /dev/null +++ b/packages/flutter_vibrate/.gitignore @@ -0,0 +1,10 @@ +.DS_Store +.dart_tool/ +.idea/ + +.packages +.pub/ +pubspec.lock + +build/ +*.iml diff --git a/packages/flutter_vibrate/CHANGELOG.md b/packages/flutter_vibrate/CHANGELOG.md new file mode 100644 index 0000000..44a91a5 --- /dev/null +++ b/packages/flutter_vibrate/CHANGELOG.md @@ -0,0 +1,35 @@ +## 1.3.0 + +* Fixing swift version + +## 1.2.0 + +* Upgrade to Android v2 embedding + +## 1.1.0 + +* Merging changes and fixing lint errors + +## 1.0.0 + +* Changing Name + +## 0.0.5 + +* Fix Gradle version in gradle-wrapper.properties + +## [0.0.4] - August 22nd, 2018 + +* add compatibility for Dart 2 sdk in pubspec.yaml + +## [0.0.3] - July 10th, 2018 + +* haptic Feedback for iOS and Android + +## [0.0.2] - January 26th, 2018 + +* added ``vibrateWithPauses(Iterable pauses)`` + +## [0.0.1] - January 24th, 2018 + +* vibrate() and canVibrate() implemented on iOS and Android \ No newline at end of file diff --git a/packages/flutter_vibrate/LICENSE b/packages/flutter_vibrate/LICENSE new file mode 100644 index 0000000..ab6b64b --- /dev/null +++ b/packages/flutter_vibrate/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Clovis NICOLAS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/flutter_vibrate/README.md b/packages/flutter_vibrate/README.md new file mode 100644 index 0000000..8e2df52 --- /dev/null +++ b/packages/flutter_vibrate/README.md @@ -0,0 +1,68 @@ +[![Buy Me A Coffee](https://img.shields.io/badge/Donate-Buy%20Me%20A%20Coffee-yellow.svg)](https://www.buymeacoffee.com/rodydavis) +[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WSH3GVC49GNNJ) +![github pages](https://github.com/rodydavis/flutter_vibrate/workflows/github%20pages/badge.svg) +[![GitHub stars](https://img.shields.io/github/stars/rodydavis/flutter_vibrate?color=blue)](https://github.com/rodydavis/flutter_vibrate) +[![flutter_vibrate](https://img.shields.io/pub/v/flutter_vibrate.svg)](https://pub.dev/packages/flutter_vibrate) + +# Vibrate + +A Flutter plugin to vibrate the device. +This uses all the current Haptic Feedback APIs from Apple and provides similar feedback on Android. + +## Getting Started + +Make sure you add the following permissions to your Android Manifest +``` xml + +``` +## Usage +``` dart +// Import package +import 'package:flutter_vibrate/flutter_vibrate.dart'; +``` + +### Vibration +``` dart +// Check if the device can vibrate +bool canVibrate = await Vibrate.canVibrate; + +// Vibrate +// Vibration duration is a constant 500ms because +// it cannot be set to a specific duration on iOS. +Vibrate.vibrate(); + +// Vibrate with pauses between each vibration +final Iterable pauses = [ + const Duration(milliseconds: 500), + const Duration(milliseconds: 1000), + const Duration(milliseconds: 500), +]; +// vibrate - sleep 0.5s - vibrate - sleep 1s - vibrate - sleep 0.5s - vibrate +Vibrate.vibrateWithPauses(pauses); +``` +### Haptic Feedback +``` dart +// Choose from any of these available methods +enum FeedbackType { + success, + error, + warning, + selection, + impact, + heavy, + medium, + light +} + +var _type = FeedbackType.impact; +Vibrate.feedback(_type); +``` +## Documentation +#### Android + +https://developer.android.com/reference/android/view/HapticFeedbackConstants + +#### iOS + +https://developer.apple.com/design/human-interface-guidelines/ios/user-interaction/feedback/ + diff --git a/packages/flutter_vibrate/analysis_options.yaml b/packages/flutter_vibrate/analysis_options.yaml new file mode 100644 index 0000000..f9b3034 --- /dev/null +++ b/packages/flutter_vibrate/analysis_options.yaml @@ -0,0 +1 @@ +include: package:flutter_lints/flutter.yaml diff --git a/packages/flutter_vibrate/android/.classpath b/packages/flutter_vibrate/android/.classpath new file mode 100644 index 0000000..8d8d85f --- /dev/null +++ b/packages/flutter_vibrate/android/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/flutter_vibrate/android/.gitignore b/packages/flutter_vibrate/android/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/packages/flutter_vibrate/android/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/packages/flutter_vibrate/android/.project b/packages/flutter_vibrate/android/.project new file mode 100644 index 0000000..9a1dda8 --- /dev/null +++ b/packages/flutter_vibrate/android/.project @@ -0,0 +1,23 @@ + + + vibrate + Project vibrate created by Buildship. + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/packages/flutter_vibrate/android/.settings/org.eclipse.buildship.core.prefs b/packages/flutter_vibrate/android/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..e889521 --- /dev/null +++ b/packages/flutter_vibrate/android/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/packages/flutter_vibrate/android/build.gradle b/packages/flutter_vibrate/android/build.gradle new file mode 100644 index 0000000..2dbd11a --- /dev/null +++ b/packages/flutter_vibrate/android/build.gradle @@ -0,0 +1,43 @@ +group 'flutter.plugins.vibrate.vibrate' +version '1.0-SNAPSHOT' + +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.0.2' + } +} + +rootProject.allprojects { + repositories { + google() + mavenCentral() + } +} + +apply plugin: 'com.android.library' + +android { + namespace "flutter.plugins.vibrate" + compileSdkVersion 30 + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + lintOptions { + disable 'InvalidPackage' + } + + if (project.android.hasProperty("namespace")) { + namespace 'flutter.plugins.vibrate' + } + +} diff --git a/packages/flutter_vibrate/android/gradle.properties b/packages/flutter_vibrate/android/gradle.properties new file mode 100644 index 0000000..8bd86f6 --- /dev/null +++ b/packages/flutter_vibrate/android/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M diff --git a/packages/flutter_vibrate/android/gradle/wrapper/gradle-wrapper.jar b/packages/flutter_vibrate/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..13372ae Binary files /dev/null and b/packages/flutter_vibrate/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/packages/flutter_vibrate/android/gradle/wrapper/gradle-wrapper.properties b/packages/flutter_vibrate/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..77e79b8 --- /dev/null +++ b/packages/flutter_vibrate/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip diff --git a/packages/flutter_vibrate/android/settings.gradle b/packages/flutter_vibrate/android/settings.gradle new file mode 100644 index 0000000..8b8d239 --- /dev/null +++ b/packages/flutter_vibrate/android/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'vibrate' diff --git a/packages/flutter_vibrate/android/src/main/AndroidManifest.xml b/packages/flutter_vibrate/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a2f47b6 --- /dev/null +++ b/packages/flutter_vibrate/android/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/packages/flutter_vibrate/android/src/main/java/flutter/plugins/vibrate/VibrateMethodCallHandler.java b/packages/flutter_vibrate/android/src/main/java/flutter/plugins/vibrate/VibrateMethodCallHandler.java new file mode 100644 index 0000000..4a47284 --- /dev/null +++ b/packages/flutter_vibrate/android/src/main/java/flutter/plugins/vibrate/VibrateMethodCallHandler.java @@ -0,0 +1,83 @@ +package flutter.plugins.vibrate; + +import android.os.Build; +import android.os.Vibrator; +import android.os.VibrationEffect; +import android.view.HapticFeedbackConstants; + +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; + +class VibrateMethodCallHandler implements MethodChannel.MethodCallHandler { + private final Vibrator vibrator; + private final boolean hasVibrator; + private final boolean legacyVibrator; + + VibrateMethodCallHandler(Vibrator vibrator) { + assert (vibrator != null); + this.vibrator = vibrator; + this.hasVibrator = vibrator.hasVibrator(); + this.legacyVibrator = Build.VERSION.SDK_INT < 26; + } + + @SuppressWarnings("deprecation") + private void vibrate(int duration) { + if (hasVibrator) { + if (legacyVibrator) { + vibrator.vibrate(duration); + } else { + vibrator.vibrate(VibrationEffect.createOneShot(duration, VibrationEffect.DEFAULT_AMPLITUDE)); + } + } + } + + @Override + public void onMethodCall(MethodCall call, MethodChannel.Result result) { + switch (call.method) { + case "canVibrate": + result.success(hasVibrator); + break; + case "vibrate": + final int duration = call.argument("duration"); + vibrate(duration); + result.success(null); + break; + case "impact": + vibrate(HapticFeedbackConstants.VIRTUAL_KEY); + result.success(null); + break; + case "selection": + vibrate(HapticFeedbackConstants.KEYBOARD_TAP); + result.success(null); + break; + case "success": + vibrate(50); + result.success(null); + break; + case "warning": + vibrate(250); + result.success(null); + break; + case "error": + vibrate(500); + result.success(null); + break; + case "heavy": + vibrate(100); + result.success(null); + break; + case "medium": + vibrate(40); + result.success(null); + break; + case "light": + vibrate(10); + result.success(null); + break; + default: + result.notImplemented(); + break; + } + + } +} diff --git a/packages/flutter_vibrate/android/src/main/java/flutter/plugins/vibrate/VibratePlugin.java b/packages/flutter_vibrate/android/src/main/java/flutter/plugins/vibrate/VibratePlugin.java new file mode 100644 index 0000000..d5080bf --- /dev/null +++ b/packages/flutter_vibrate/android/src/main/java/flutter/plugins/vibrate/VibratePlugin.java @@ -0,0 +1,29 @@ +package flutter.plugins.vibrate; + +import android.content.Context; +import android.os.Vibrator; + +import io.flutter.embedding.engine.plugins.FlutterPlugin; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugin.common.MethodChannel; + +public class VibratePlugin implements FlutterPlugin { + private MethodChannel methodChannel; + + @Override + public void onAttachedToEngine(FlutterPluginBinding binding) { + final Context context = binding.getApplicationContext(); + final BinaryMessenger messenger = binding.getBinaryMessenger(); + final Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); + final VibrateMethodCallHandler methodCallHandler = new VibrateMethodCallHandler(vibrator); + + this.methodChannel = new MethodChannel(messenger, "vibrate"); + this.methodChannel.setMethodCallHandler(methodCallHandler); + } + + @Override + public void onDetachedFromEngine(FlutterPluginBinding binding) { + this.methodChannel.setMethodCallHandler(null); + this.methodChannel = null; + } +} diff --git a/packages/flutter_vibrate/example/.gitignore b/packages/flutter_vibrate/example/.gitignore new file mode 100644 index 0000000..ae1f183 --- /dev/null +++ b/packages/flutter_vibrate/example/.gitignore @@ -0,0 +1,37 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Exceptions to above rules. +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages diff --git a/packages/flutter_vibrate/example/.metadata b/packages/flutter_vibrate/example/.metadata new file mode 100644 index 0000000..1b5cec0 --- /dev/null +++ b/packages/flutter_vibrate/example/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 27321ebbad34b0a3fafe99fac037102196d655ff + channel: stable + +project_type: app diff --git a/packages/flutter_vibrate/example/README.md b/packages/flutter_vibrate/example/README.md new file mode 100644 index 0000000..a135626 --- /dev/null +++ b/packages/flutter_vibrate/example/README.md @@ -0,0 +1,16 @@ +# example + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/packages/flutter_vibrate/example/analysis_options.yaml b/packages/flutter_vibrate/example/analysis_options.yaml new file mode 100644 index 0000000..f9b3034 --- /dev/null +++ b/packages/flutter_vibrate/example/analysis_options.yaml @@ -0,0 +1 @@ +include: package:flutter_lints/flutter.yaml diff --git a/packages/flutter_vibrate/example/android/.gitignore b/packages/flutter_vibrate/example/android/.gitignore new file mode 100644 index 0000000..bc2100d --- /dev/null +++ b/packages/flutter_vibrate/example/android/.gitignore @@ -0,0 +1,7 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java diff --git a/packages/flutter_vibrate/example/android/app/build.gradle b/packages/flutter_vibrate/example/android/app/build.gradle new file mode 100644 index 0000000..ee1a6d0 --- /dev/null +++ b/packages/flutter_vibrate/example/android/app/build.gradle @@ -0,0 +1,61 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 30 + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.example" + minSdkVersion 16 + targetSdkVersion 30 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test:runner:1.4.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} diff --git a/packages/flutter_vibrate/example/android/app/src/debug/AndroidManifest.xml b/packages/flutter_vibrate/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..c208884 --- /dev/null +++ b/packages/flutter_vibrate/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/flutter_vibrate/example/android/app/src/main/AndroidManifest.xml b/packages/flutter_vibrate/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..818ddd4 --- /dev/null +++ b/packages/flutter_vibrate/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + diff --git a/packages/flutter_vibrate/example/android/app/src/main/java/com/example/example/MainActivity.java b/packages/flutter_vibrate/example/android/app/src/main/java/com/example/example/MainActivity.java new file mode 100644 index 0000000..ae0a572 --- /dev/null +++ b/packages/flutter_vibrate/example/android/app/src/main/java/com/example/example/MainActivity.java @@ -0,0 +1,13 @@ +package com.example.example; + +import androidx.annotation.NonNull; +import io.flutter.embedding.android.FlutterActivity; +import io.flutter.embedding.engine.FlutterEngine; +import io.flutter.plugins.GeneratedPluginRegistrant; + +public class MainActivity extends FlutterActivity { + @Override + public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + } +} diff --git a/packages/flutter_vibrate/example/android/app/src/main/res/drawable/launch_background.xml b/packages/flutter_vibrate/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/packages/flutter_vibrate/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/packages/flutter_vibrate/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/packages/flutter_vibrate/example/android/app/src/main/res/values/styles.xml b/packages/flutter_vibrate/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..00fa441 --- /dev/null +++ b/packages/flutter_vibrate/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + diff --git a/packages/flutter_vibrate/example/android/app/src/profile/AndroidManifest.xml b/packages/flutter_vibrate/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..c208884 --- /dev/null +++ b/packages/flutter_vibrate/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/flutter_vibrate/example/android/build.gradle b/packages/flutter_vibrate/example/android/build.gradle new file mode 100644 index 0000000..9971094 --- /dev/null +++ b/packages/flutter_vibrate/example/android/build.gradle @@ -0,0 +1,29 @@ +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.0.2' + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/packages/flutter_vibrate/example/android/gradle.properties b/packages/flutter_vibrate/example/android/gradle.properties new file mode 100644 index 0000000..38c8d45 --- /dev/null +++ b/packages/flutter_vibrate/example/android/gradle.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx1536M +android.enableR8=true +android.useAndroidX=true +android.enableJetifier=true diff --git a/packages/flutter_vibrate/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/flutter_vibrate/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..5917028 --- /dev/null +++ b/packages/flutter_vibrate/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Sep 20 09:29:17 CEST 2021 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/packages/flutter_vibrate/example/android/settings.gradle b/packages/flutter_vibrate/example/android/settings.gradle new file mode 100644 index 0000000..5a2f14f --- /dev/null +++ b/packages/flutter_vibrate/example/android/settings.gradle @@ -0,0 +1,15 @@ +include ':app' + +def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + +def plugins = new Properties() +def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') +if (pluginsFile.exists()) { + pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } +} + +plugins.each { name, path -> + def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() + include ":$name" + project(":$name").projectDir = pluginDirectory +} diff --git a/packages/flutter_vibrate/example/ios/.gitignore b/packages/flutter_vibrate/example/ios/.gitignore new file mode 100644 index 0000000..e96ef60 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/.gitignore @@ -0,0 +1,32 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/packages/flutter_vibrate/example/ios/Flutter/AppFrameworkInfo.plist b/packages/flutter_vibrate/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..f2872cf --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 9.0 + + diff --git a/packages/flutter_vibrate/example/ios/Flutter/Debug.xcconfig b/packages/flutter_vibrate/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..e8efba1 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/packages/flutter_vibrate/example/ios/Flutter/Release.xcconfig b/packages/flutter_vibrate/example/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..399e934 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/packages/flutter_vibrate/example/ios/Flutter/ephemeral/flutter_lldb_helper.py b/packages/flutter_vibrate/example/ios/Flutter/ephemeral/flutter_lldb_helper.py new file mode 100644 index 0000000..a88caf9 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Flutter/ephemeral/flutter_lldb_helper.py @@ -0,0 +1,32 @@ +# +# Generated file, do not edit. +# + +import lldb + +def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict): + """Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages.""" + base = frame.register["x0"].GetValueAsAddress() + page_len = frame.register["x1"].GetValueAsUnsigned() + + # Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the + # first page to see if handled it correctly. This makes diagnosing + # misconfiguration (e.g. missing breakpoint) easier. + data = bytearray(page_len) + data[0:8] = b'IHELPED!' + + error = lldb.SBError() + frame.GetThread().GetProcess().WriteMemory(base, data, error) + if not error.Success(): + print(f'Failed to write into {base}[+{page_len}]', error) + return + +def __lldb_init_module(debugger: lldb.SBDebugger, _): + target = debugger.GetDummyTarget() + # Caveat: must use BreakpointCreateByRegEx here and not + # BreakpointCreateByName. For some reasons callback function does not + # get carried over from dummy target for the later. + bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$") + bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__)) + bp.SetAutoContinue(True) + print("-- LLDB integration loaded --") diff --git a/packages/flutter_vibrate/example/ios/Flutter/ephemeral/flutter_lldbinit b/packages/flutter_vibrate/example/ios/Flutter/ephemeral/flutter_lldbinit new file mode 100644 index 0000000..e3ba6fb --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Flutter/ephemeral/flutter_lldbinit @@ -0,0 +1,5 @@ +# +# Generated file, do not edit. +# + +command script import --relative-to-command-file flutter_lldb_helper.py diff --git a/packages/flutter_vibrate/example/ios/Podfile b/packages/flutter_vibrate/example/ios/Podfile new file mode 100644 index 0000000..1e8c3c9 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Podfile @@ -0,0 +1,41 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '9.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/packages/flutter_vibrate/example/ios/Podfile.lock b/packages/flutter_vibrate/example/ios/Podfile.lock new file mode 100644 index 0000000..fcf6bdc --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Podfile.lock @@ -0,0 +1,22 @@ +PODS: + - Flutter (1.0.0) + - flutter_vibrate (0.0.1): + - Flutter + +DEPENDENCIES: + - Flutter (from `Flutter`) + - flutter_vibrate (from `.symlinks/plugins/flutter_vibrate/ios`) + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + flutter_vibrate: + :path: ".symlinks/plugins/flutter_vibrate/ios" + +SPEC CHECKSUMS: + Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a + flutter_vibrate: c0ca4ac994ff97c3f147f69865458bbc0cc3508b + +PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c + +COCOAPODS: 1.10.1 diff --git a/packages/flutter_vibrate/example/ios/Runner.xcodeproj/project.pbxproj b/packages/flutter_vibrate/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..d43db09 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,572 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 22FFFBD0F8E74FB73DC242DD /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA46F60EE46B5998BF307D72 /* Pods_Runner.framework */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 1781E372D42A3350B69093C0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 4BC2C61693CDFA297634104F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7C28F0C6F036694B70324616 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DA46F60EE46B5998BF307D72 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 22FFFBD0F8E74FB73DC242DD /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2723E2A00764DF74F4431D32 /* Pods */ = { + isa = PBXGroup; + children = ( + 4BC2C61693CDFA297634104F /* Pods-Runner.debug.xcconfig */, + 7C28F0C6F036694B70324616 /* Pods-Runner.release.xcconfig */, + 1781E372D42A3350B69093C0 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 6A5934F9A8576787A4C7ED2D /* Frameworks */ = { + isa = PBXGroup; + children = ( + DA46F60EE46B5998BF307D72 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 2723E2A00764DF74F4431D32 /* Pods */, + 6A5934F9A8576787A4C7ED2D /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 97C146F11CF9000F007C117D /* Supporting Files */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; + 97C146F11CF9000F007C117D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9D5D0A6B2BA6FAD51FD140BE /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 12298C3401E394B168BC3D03 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = "The Chromium Authors"; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 12298C3401E394B168BC3D03 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/flutter_vibrate/flutter_vibrate.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_vibrate.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + 9D5D0A6B2BA6FAD51FD140BE /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/packages/flutter_vibrate/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/flutter_vibrate/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/flutter_vibrate/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/flutter_vibrate/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..a28140c --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/flutter_vibrate/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/flutter_vibrate/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..21a3cc1 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/packages/flutter_vibrate/example/ios/Runner/AppDelegate.swift b/packages/flutter_vibrate/example/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..70693e4 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..28c6bf0 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..2ccbfd9 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..f091b6b Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cde121 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..d0ef06e Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..dcdc230 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..2ccbfd9 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..c8f9ed8 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..a6d6b86 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..a6d6b86 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..75b2d16 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..c4df70d Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..6a84f41 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..d0e1f58 Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/packages/flutter_vibrate/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/flutter_vibrate/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/flutter_vibrate/example/ios/Runner/Base.lproj/Main.storyboard b/packages/flutter_vibrate/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/flutter_vibrate/example/ios/Runner/Info.plist b/packages/flutter_vibrate/example/ios/Runner/Info.plist new file mode 100644 index 0000000..a060db6 --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/packages/flutter_vibrate/example/ios/Runner/Runner-Bridging-Header.h b/packages/flutter_vibrate/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..7335fdf --- /dev/null +++ b/packages/flutter_vibrate/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" \ No newline at end of file diff --git a/packages/flutter_vibrate/example/lib/main.dart b/packages/flutter_vibrate/example/lib/main.dart new file mode 100644 index 0000000..d26268c --- /dev/null +++ b/packages/flutter_vibrate/example/lib/main.dart @@ -0,0 +1,142 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_vibrate/flutter_vibrate.dart'; + +void main() => runApp(const MyApp()); + +class MyApp extends StatefulWidget { + const MyApp({Key? key}) : super(key: key); + + @override + _MyAppState createState() => _MyAppState(); +} + +class _MyAppState extends State { + bool _canVibrate = true; + final Iterable pauses = [ + const Duration(milliseconds: 500), + const Duration(milliseconds: 1000), + const Duration(milliseconds: 500), + ]; + + @override + void initState() { + super.initState(); + _init(); + } + + Future _init() async { + bool canVibrate = await Vibrate.canVibrate; + setState(() { + _canVibrate = canVibrate; + _canVibrate + ? debugPrint('This device can vibrate') + : debugPrint('This device cannot vibrate'); + }); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar(title: const Text('Haptic Feedback Example')), + body: Center( + child: ListView(children: [ + ListTile( + title: const Text('Vibrate'), + leading: const Icon(Icons.vibration, color: Colors.teal), + onTap: () { + if (_canVibrate) Vibrate.vibrate; + }, + ), + ListTile( + title: const Text('Vibrate with Pauses'), + leading: const Icon(Icons.vibration, color: Colors.brown), + onTap: () { + if (_canVibrate) { + Vibrate.vibrateWithPauses(pauses); + } + }, + ), + const Divider(height: 1), + ListTile( + title: const Text('Impact'), + leading: const Icon(Icons.tap_and_play, color: Colors.orange), + onTap: () { + if (_canVibrate) { + Vibrate.feedback(FeedbackType.impact); + } + }, + ), + ListTile( + title: const Text('Selection'), + leading: const Icon(Icons.select_all, color: Colors.blue), + onTap: () { + if (_canVibrate) { + Vibrate.feedback(FeedbackType.selection); + } + }, + ), + ListTile( + title: const Text('Success'), + leading: const Icon(Icons.check, color: Colors.green), + onTap: () { + if (_canVibrate) { + Vibrate.feedback(FeedbackType.success); + } + }, + ), + ListTile( + title: const Text('Warning'), + leading: const Icon(Icons.warning, color: Colors.red), + onTap: () { + if (_canVibrate) { + Vibrate.feedback(FeedbackType.warning); + } + }, + ), + ListTile( + title: const Text('Error'), + leading: const Icon(Icons.error, color: Colors.red), + onTap: () { + if (_canVibrate) { + Vibrate.feedback(FeedbackType.error); + } + }, + ), + const Divider(height: 1), + ListTile( + title: const Text('Heavy'), + leading: + const Icon(Icons.notification_important, color: Colors.red), + onTap: () { + if (_canVibrate) { + Vibrate.feedback(FeedbackType.heavy); + } + }, + ), + ListTile( + title: const Text('Medium'), + leading: + const Icon(Icons.notification_important, color: Colors.green), + onTap: () { + if (_canVibrate) { + Vibrate.feedback(FeedbackType.medium); + } + }, + ), + ListTile( + title: const Text('Light'), + leading: + Icon(Icons.notification_important, color: Colors.yellow[700]), + onTap: () { + if (_canVibrate) { + Vibrate.feedback(FeedbackType.light); + } + }, + ), + ]), + ), + ), + ); + } +} diff --git a/packages/flutter_vibrate/example/pubspec.yaml b/packages/flutter_vibrate/example/pubspec.yaml new file mode 100644 index 0000000..40e8e93 --- /dev/null +++ b/packages/flutter_vibrate/example/pubspec.yaml @@ -0,0 +1,21 @@ +name: vibrate_example +description: Demonstrates how to use the vibrate plugin. +publish_to: none +version: 1.0.0+1 + +environment: + sdk: '>=2.12.0 <3.0.0' + +dependencies: + flutter: + sdk: flutter + flutter_vibrate: + path: ../ + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^1.0.4 + +flutter: + uses-material-design: true diff --git a/packages/flutter_vibrate/ios/.gitignore b/packages/flutter_vibrate/ios/.gitignore new file mode 100644 index 0000000..710ec6c --- /dev/null +++ b/packages/flutter_vibrate/ios/.gitignore @@ -0,0 +1,36 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ +GeneratedPluginRegistrant.h +GeneratedPluginRegistrant.m + +.generated/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +/Flutter/Generated.xcconfig diff --git a/packages/flutter_vibrate/ios/Assets/.gitkeep b/packages/flutter_vibrate/ios/Assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/flutter_vibrate/ios/Classes/SwiftVibratePlugin.swift b/packages/flutter_vibrate/ios/Classes/SwiftVibratePlugin.swift new file mode 100644 index 0000000..83ba6c7 --- /dev/null +++ b/packages/flutter_vibrate/ios/Classes/SwiftVibratePlugin.swift @@ -0,0 +1,101 @@ +import Flutter +import UIKit +import AudioToolbox + +private let isDevice = TARGET_OS_SIMULATOR == 0 + +public class SwiftVibratePlugin: NSObject, FlutterPlugin { + public static func register(with registrar: FlutterPluginRegistrar) { + let channel = FlutterMethodChannel(name: "vibrate", binaryMessenger: registrar.messenger()) + let instance = SwiftVibratePlugin() + registrar.addMethodCallDelegate(instance, channel: channel) + } + + public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { + switch (call.method) { + case "canVibrate": + if isDevice { + result(true) + } else { + result(false) + } + case "vibrate": + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) + // Feedback + case "impact": + if #available(iOS 10.0, *) { + let impact = UIImpactFeedbackGenerator() + impact.prepare() + impact.impactOccurred() + } else { + // Fallback on earlier versions + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) + } + case "selection": + if #available(iOS 10.0, *) { + let selection = UISelectionFeedbackGenerator() + selection.prepare() + selection.selectionChanged() + } else { + // Fallback on earlier versions + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) + } + case "success": + if #available(iOS 10.0, *) { + let notification = UINotificationFeedbackGenerator() + notification.prepare() + notification.notificationOccurred(.success) + } else { + // Fallback on earlier versions + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) + } + case "warning": + if #available(iOS 10.0, *) { + let notification = UINotificationFeedbackGenerator() + notification.prepare() + notification.notificationOccurred(.warning) + } else { + // Fallback on earlier versions + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) + } + case "error": + if #available(iOS 10.0, *) { + let notification = UINotificationFeedbackGenerator() + notification.prepare() + notification.notificationOccurred(.error) + } else { + // Fallback on earlier versions + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) + } + case "heavy": + if #available(iOS 10.0, *) { + let generator = UIImpactFeedbackGenerator(style: .heavy) + generator.prepare() + generator.impactOccurred() + } else { + // Fallback on earlier versions + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) + } + case "medium": + if #available(iOS 10.0, *) { + let generator = UIImpactFeedbackGenerator(style: .medium) + generator.prepare() + generator.impactOccurred() + } else { + // Fallback on earlier versions + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) + } + case "light": + if #available(iOS 10.0, *) { + let generator = UIImpactFeedbackGenerator(style: .light) + generator.prepare() + generator.impactOccurred() + } else { + // Fallback on earlier versions + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) + } + default: + result(FlutterMethodNotImplemented) + } + } +} diff --git a/packages/flutter_vibrate/ios/Classes/VibratePlugin.h b/packages/flutter_vibrate/ios/Classes/VibratePlugin.h new file mode 100644 index 0000000..c963b2f --- /dev/null +++ b/packages/flutter_vibrate/ios/Classes/VibratePlugin.h @@ -0,0 +1,4 @@ +#import + +@interface VibratePlugin : NSObject +@end diff --git a/packages/flutter_vibrate/ios/Classes/VibratePlugin.m b/packages/flutter_vibrate/ios/Classes/VibratePlugin.m new file mode 100644 index 0000000..a7dffaa --- /dev/null +++ b/packages/flutter_vibrate/ios/Classes/VibratePlugin.m @@ -0,0 +1,8 @@ +#import "VibratePlugin.h" +#import + +@implementation VibratePlugin ++ (void)registerWithRegistrar:(NSObject*)registrar { + [SwiftVibratePlugin registerWithRegistrar:registrar]; +} +@end diff --git a/packages/flutter_vibrate/ios/flutter_vibrate.podspec b/packages/flutter_vibrate/ios/flutter_vibrate.podspec new file mode 100644 index 0000000..31b5382 --- /dev/null +++ b/packages/flutter_vibrate/ios/flutter_vibrate.podspec @@ -0,0 +1,21 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html +# +Pod::Spec.new do |s| + s.name = 'flutter_vibrate' + s.version = '0.0.1' + s.summary = 'A new Flutter plugin.' + s.description = <<-DESC +A new Flutter plugin. + DESC + s.homepage = 'http://example.com' + s.license = { :file => '../LICENSE' } + s.author = { 'Your Company' => 'email@example.com' } + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + s.public_header_files = 'Classes/**/*.h' + s.dependency 'Flutter' + s.swift_version = '5.0' + s.ios.deployment_target = '8.0' +end + diff --git a/packages/flutter_vibrate/lib/flutter_vibrate.dart b/packages/flutter_vibrate/lib/flutter_vibrate.dart new file mode 100644 index 0000000..a160bf4 --- /dev/null +++ b/packages/flutter_vibrate/lib/flutter_vibrate.dart @@ -0,0 +1,76 @@ +import 'dart:async'; + +import 'package:flutter/services.dart'; + +enum FeedbackType { + success, + error, + warning, + selection, + impact, + heavy, + medium, + light +} + +class Vibrate { + static const MethodChannel _channel = MethodChannel('vibrate'); + static const Duration defaultVibrationDuration = 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': defaultVibrationDuration.inMilliseconds}, + ); + + /// Whether the device can actually vibrate or not + static Future get canVibrate async { + final bool isOn = await _channel.invokeMethod('canVibrate'); + return isOn; + } + + static void feedback(FeedbackType type) { + switch (type) { + case FeedbackType.impact: + _channel.invokeMethod('impact'); + break; + case FeedbackType.error: + _channel.invokeMethod('error'); + break; + case FeedbackType.success: + _channel.invokeMethod('success'); + break; + case FeedbackType.warning: + _channel.invokeMethod('warning'); + break; + case FeedbackType.selection: + _channel.invokeMethod('selection'); + break; + case FeedbackType.heavy: + _channel.invokeMethod('heavy'); + break; + case FeedbackType.medium: + _channel.invokeMethod('medium'); + break; + case FeedbackType.light: + _channel.invokeMethod('light'); + break; + default: + } + } + + /// Vibrates with [pauses] in between each vibration + /// Will always vibrate once before the first pause + /// and once after the last pause + + static Future vibrateWithPauses(Iterable pauses) async { + 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 Future.delayed(defaultVibrationDuration); + await Future.delayed(d); + } + await vibrate(); + } +} diff --git a/packages/flutter_vibrate/pubspec.yaml b/packages/flutter_vibrate/pubspec.yaml new file mode 100644 index 0000000..a9a1a22 --- /dev/null +++ b/packages/flutter_vibrate/pubspec.yaml @@ -0,0 +1,25 @@ +name: flutter_vibrate +description: A Haptic Feedback plugin. +version: 1.3.0 +environment: + sdk: '>=2.12.0 <3.0.0' + flutter: ^1.10.0 +maintainer: Rody Davis (@rodydavis) +homepage: https://github.com/rodydavis/plugins +repository: https://github.com/rodydavis/flutter_vibrate + +dependencies: + flutter: + sdk: flutter + +dev_dependencies: + flutter_lints: ^1.0.4 + +flutter: + plugin: + platforms: + android: + package: flutter.plugins.vibrate + pluginClass: VibratePlugin + ios: + pluginClass: VibratePlugin