V

vibration_aurora

Flutter plugin vibration to OS Aurora

EN | RU

Original README

Vibration_aurora

Plugin for vibration motor control on Aurora OS devices. The plugin is an implementation vibration.

Usage example:

Vibration.vibrate();

Contents

Installation and build

To use the plugin, you need to modify the .spec file.:

BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Feedback)

You also need to enable Qt support in aurora/main.cpp :

#include <flutter/flutter_aurora.h>
#include <flutter/flutter_compatibility_qt.h>  // Add for Qt
#include "generated_plugin_registrant.h"

int main(int argc, char* argv[]) {
    aurora::Initialize(argc, argv);
    aurora::EnableQtCompatibility(); // Add for Qt
    aurora::RegisterPlugins();
    aurora::Launch();
    return 0;
}

Add the plugin depending on the target application in the pubspec.yaml file:

dependencies:
  vibration: ^3.1.3
  vibration_aurora:
    git:
      url: https://developer.auroraos.ru/git/flutter/flutter-community-plugins/vibration_aurora

And update the dependencies:

flutter-aurora pub get

Detailed description

The plugin implements the functions of the vibration plugin.

hasVibrator

Check if the target device has vibration capabilities.

  await Vibration.hasVibrator();

hasAmplitudeControl

Check if possibility of controlling the amplitude. Returns a value similar to hasVibrator()

  await Vibration.hasAmplitudeControl();

hasCustomVibrationsSupport

Check if possibility of set duration of vibration. Returns a value similar to hasVibrator()

  await Vibration.hasCustomVibrationsSupport();

vibrate

A method for controlling device vibration.

Arguments

  • duration - Duration of vibration in ms. The default is 500 ms.
  • amplitude - The amplitude of vibration. Range is 1 to 255. The default is 1.
  • effect - Predefined vibration effect. Redefines vibration effects.
Vibration with amplitude and duration
  Vibration.vibrate(duration: 2000, amplitude: 255);
Vibration with effect
  VibrationAurora().vibrate(effect: VibrateEffect.press);

Vibration effects

  • VibrateEffect.press
  • VibrateEffect.release
  • VibrateEffect.pressWeak
  • VibrateEffect.releaseWeak
  • VibrateEffect.pressStrong
  • VibrateEffect.releaseStrong
  • VibrateEffect.dragStart
  • VibrateEffect.dragDropInZone
  • VibrateEffect.dragDropOutOfZone
  • VibrateEffect.dragCrossBoundary
  • VibrateEffect.appear
  • VibrateEffect.disappear
  • VibrateEffect.move

cancel

Stop the current vibration.

  Vibration.cancel();

Information about branches

The versions of the application comply with the branch naming agreement .

Known errors

There are problems with setting the vibration amplitude on some devices.

Compatibility

The application has been working correctly since the 5.0.0 version of the Aurora OS.

Terms of Use and Participation

The source code of the project is provided under the license, that allows it to be used in third-party applications.

To participate in the development of the project, please read the contributor agreement. If you plan to contribute your own source code to the project, you will need to accept the CLA agreement.

For information about contributors see AUTHORS.

Code of conduct is a current set of rules of the Open Mobile Platform which informs you how we expect the members of the community will interact while contributing and communicating.