deven98 / shake

A flutter package for detecting phone shakes.
BSD 2-Clause "Simplified" License
92 stars 52 forks source link

How to install? #3

Closed fabioselau077 closed 2 years ago

fabioselau077 commented 4 years ago

Hello, is this to check when the user shakes the phone? How to do an installation? I'm used to installing it through pub.dev. As it happens on Facebook when you shake your phone and a message appears to receive feedback, can you implement it with this package?

deven98 commented 3 years ago

Hey @fabioselau077.

Yes, you can implement similar functionality with this package.

The general steps would be:

1) Add latest version of the package to your pubspec.yaml file.

2) In your code, add

ShakeDetector detector = ShakeDetector.autoStart(
    onPhoneShake: () {
        // Do stuff on phone shake
    }
);

and add your feedback form in the onPhoneShake method.

3) Cancel listening when done by calling:

detector.stopListening();