Skip to content
pubscout

shake_detector

0.1.2, released 3 years ago by folksable.com

Detect phone shake gestures with pause/resume and optional widget wrapper

WASM-ready
$ flutter pub add shake_detector
Source repository

What it does

The package listens to device sensors to detect shake gestures and exposes callbacks. It can be used as a widget wrapper or a listener class, with automatic pause/resume when the app goes to background or foreground.

AI-written summary of version 0.1.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Need shake gesture detection in a Flutter app
  • Want automatic pause/resume when app backgrounded
  • Prefer a simple widget wrapper for UI integration

Skip it when

  • You need custom shake sensitivity or advanced motion analysis
  • You already have a custom sensor listener implementation

Strengths

  • Easy to integrate via widget or listener
  • Handles background/foreground pause automatically
  • No extra build_runner or codegen required

Weaknesses

  • Only supports sensors_plus; no custom sensitivity settings documented
  • Limited to shake detection, no other motion gestures

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
```dart
class HomePage extends StatelessWidget {
  const HomePage({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('ShakeGesture Example')),
      body: Center(
        child: ShakeDetectWrap(
          enabled: true,
          onShake: () {
            ScaffoldMessenger.of(context).showSnackBar(
              const SnackBar(content: Text('Shake!')),
            );
          },
          child: const Center(
            child: OutlinedButton(
              onPressed: ShakeGestureTestHelperExtension.simulateShake,
              child: Text('Simulate Shake'),
            ),
          ),
        ),
      ),
    );
  }
}
```

Alternatives

Packages that do the same job and could replace shake_detector.

Works with

Packages commonly used together with shake_detector: ones it builds on, ones built on it, and its own family.