{"id":32282775,"url":"https://github.com/tpucci/shake_gesture","last_synced_at":"2026-02-23T14:34:07.772Z","repository":{"id":185943896,"uuid":"674368464","full_name":"tpucci/shake_gesture","owner":"tpucci","description":"0 dependencies Flutter plugin that detects shake gestures on Android and iOS (even on simulators).","archived":false,"fork":false,"pushed_at":"2025-10-07T08:32:44.000Z","size":178,"stargazers_count":12,"open_issues_count":6,"forks_count":4,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-22T23:01:06.837Z","etag":null,"topics":["flutter","flutter-plugin"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tpucci.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-08-03T19:22:14.000Z","updated_at":"2025-11-26T14:09:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"c1806198-74be-4079-b91c-8d48a6980332","html_url":"https://github.com/tpucci/shake_gesture","commit_stats":null,"previous_names":["tpucci/shake_gesture"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/tpucci/shake_gesture","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpucci%2Fshake_gesture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpucci%2Fshake_gesture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpucci%2Fshake_gesture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpucci%2Fshake_gesture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpucci","download_url":"https://codeload.github.com/tpucci/shake_gesture/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpucci%2Fshake_gesture/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29745648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flutter","flutter-plugin"],"created_at":"2025-10-23T01:05:28.284Z","updated_at":"2026-02-23T14:34:07.767Z","avatar_url":"https://github.com/tpucci.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shake_gesture\n\nThis Flutter plugin detects shake gestures on Android and iOS.\n\n\u003e This plugin has 0 dependencies 🚀\n\n\u003e This plugin works on simulators 🤖\n\n## Usage\n\n### Imperatively\n\n```dart\nvoid main() {\n  void myCallback() {}\n\n  // Register the callback\n  ShakeGesture.registerCallback(onShake: myCallback)\n\n  // In dispose functions, don't forget to clean up\n  ShakeGesture.unregisterCallback(onShake: myCallback)\n}\n\n```\n\n### Widget\n\n```dart\nclass HomePage extends StatelessWidget {\n  const HomePage({super.key});\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(title: const Text('ShakeGesture Example')),\n      body: Center(\n\n\t\t// Here it is 👇\n\n        child: ShakeGesture(\n          onShake: () {\n            ScaffoldMessenger.of(context).showSnackBar(\n              const SnackBar(content: Text('Shake!')),\n            );\n          },\n          child: const Center(\n            child: OutlinedButton(\n              onPressed: ShakeGestureTestHelperExtension.simulateShake,\n              child: Text('Simulate Shake'),\n            ),\n          ),\n        ),\n\n\t\t// The end.\n\n      ),\n    );\n  }\n}\n```\n\n## Simulator\n\nThis package works in the iOS simulator.\n\nTo simulate a shake event in Android emulator, either play with the Sensor Manager, or add the following piece of code to your Activity:\n\n```kotlin\nimport android.view.KeyEvent\nimport dev.fluttercommunity.shake_gesture_android.ShakeGesturePlugin\n\nclass MainActivity: FlutterActivity() {\n\n    override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {\n        if (keyCode == KeyEvent.KEYCODE_MENU) {\n            this.flutterEngine?.plugins?.get(ShakeGesturePlugin::class.java).let { plugin -\u003e\n                if (plugin is ShakeGesturePlugin)\n                    plugin.onShake()\n            }\n        }\n\n        return super.onKeyDown(keyCode, event)\n    }\n\n}\n```\n\nThen, you can use ctrl+m or cmd+m (mac) to simulate a shake motion.\n\n## Test Helper\n\nIn order to simulate a shake gesture in a test, add the following package:\n\n`shake_gesture_test_helper`\n\nAnd call the `shake` method on your `widgetTester`:\n\n```dart\n    testWidgets('it detects shakes', (widgetTester) async {\n      var shakeDetected = false;\n      await widgetTester.pumpWidget(\n        ShakeGesture(\n          onShake: () {\n            shakeDetected = true;\n          },\n          child: Container(),\n        ),\n      );\n      await widgetTester.shake();\n      expect(shakeDetected, true);\n    });\n```\n\n## Customize required shake gesture\n\n### iOS\n\nUnfortunatly, you can not customize the shake gesture on iOS.\nIndeed, this package depends on the Apple SDK's [`motionShake`](https://developer.apple.com/documentation/uikit/uievent/eventsubtype/motionshake).\n\n### Android\n\nBy default, the required shake force is `6 Newtons` and the required number of shakes is `6`.\nThis can be overriden in your `AndroidManifest.xml` file:\n\n```xml\n\u003cmanifest ...\u003e\n    \u003capplication ...\u003e\n        \u003cmeta-data\n            android:name=\"dev.fluttercommunity.shake_gesture_android.SHAKE_FORCE\"\n            android:value=\"4\" /\u003e\n    \u003c/application\u003e\n\u003c/manifest\u003e\n```\n\n## Contribute\n\nTest your contribution by running the unit tests and integration tests.\n\n```sh\ncd shake_gesture/example\nflutter test\nflutter test integration_test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpucci%2Fshake_gesture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpucci%2Fshake_gesture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpucci%2Fshake_gesture/lists"}