shake_gesture 0.1.3 copy "shake_gesture: ^0.1.3" to clipboard
shake_gesture: ^0.1.3 copied to clipboard

Provides a widget to detect shake gestures. It allows you to easily add shake detection to your Flutter app on Android and iOS.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:shake_gesture/shake_gesture.dart';
import 'package:shake_gesture_test_helper/shake_gesture_test_helper.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key}) : super();

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: HomePage());
  }
}

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: ShakeGesture(
          onShake: () {
            ScaffoldMessenger.of(context).showSnackBar(
              const SnackBar(content: Text('Shake!')),
            );
          },
          child: const Center(
            child: OutlinedButton(
              onPressed: ShakeGestureTestHelperExtension.simulateShake,
              child: Text('Simulate Shake'),
            ),
          ),
        ),
      ),
    );
  }
}
16
likes
150
points
16.7k
downloads

Publisher

verified publisherthomaspucci.com

Weekly Downloads

Provides a widget to detect shake gestures. It allows you to easily add shake detection to your Flutter app on Android and iOS.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, shake_gesture_android, shake_gesture_ios, shake_gesture_platform_interface

More

Packages that depend on shake_gesture