From e992cfb76959dabc1f6c37235757300fab080ac4 Mon Sep 17 00:00:00 2001 From: Lisette Linse Date: Fri, 10 Apr 2026 20:27:07 +0200 Subject: [PATCH 1/3] docs: Move 'How it works' section out of 'Usage' section --- packages/flutter_gamepads/README.md | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/flutter_gamepads/README.md b/packages/flutter_gamepads/README.md index 8dbe5e21..688ea7c6 100644 --- a/packages/flutter_gamepads/README.md +++ b/packages/flutter_gamepads/README.md @@ -133,24 +133,6 @@ use `onBeforeIntent` to block intents from all but one of the `GamepadControl` w The `GamepadControl` widget does not check if primaryFocus is a descendant of itself. -### How it works - -`GamepadControl` listens on `NormalizedGamepadEvent` from *gamepads* package and maps those -to a `GamepadActivator` and its related `Intent`. - -Input repetition is conceptually started on activation of a GamepadActivator and stopped -once the activator has been canceled (eg. button up or axis below minimum threshold). - -`GamepadControl` will lookup the closest ancestor `GamepadInterceptor` from `primaryFocus` -and call its `onBeforeIntent` first (if there is one), and then proceed to `onBeforeIntent` on -`GamepadControl`. Calling is lazy so if the local `onBeforeIntent` returns fall, the one on -`GamepadControl` is not called. - -If no onBeforeIntent has rejected, the Intent will be invoked on the primary focus context. - -[Diagram of the callbacks and intent emit chain](https://raw.githubusercontent.com/flame-engine/gamepads/refs/heads/main/packages/flutter_gamepads/doc/input_diagram.svg) - - ### Defaults By default `GamepadControl` comes with these bindings: @@ -195,6 +177,24 @@ Flame game that you want users to be able to navigate with their gamepad. `ignoreEvents = true` on it. +## How it works + +`GamepadControl` listens on `NormalizedGamepadEvent` from *gamepads* package and maps those +to a `GamepadActivator` and its related `Intent`. + +Input repetition is conceptually started on activation of a GamepadActivator and stopped +once the activator has been canceled (eg. button up or axis below minimum threshold). + +`GamepadControl` will lookup the closest ancestor `GamepadInterceptor` from `primaryFocus` +and call its `onBeforeIntent` first (if there is one), and then proceed to `onBeforeIntent` on +`GamepadControl`. Calling is lazy so if the local `onBeforeIntent` returns fall, the one on +`GamepadControl` is not called. + +If no onBeforeIntent has rejected, the Intent will be invoked on the primary focus context. + +[Diagram of the callbacks and intent emit chain](https://raw.githubusercontent.com/flame-engine/gamepads/refs/heads/main/packages/flutter_gamepads/doc/input_diagram.svg) + + ## Code example In the example folder there is both a full Flutter app and a full Flame game example showing From 941f0f8d2d5d40bbba447047bfb290616e0d0f1b Mon Sep 17 00:00:00 2001 From: Lisette Linse Date: Fri, 10 Apr 2026 20:28:46 +0200 Subject: [PATCH 2/3] docs: Fix reference to gamepads package --- packages/flutter_gamepads/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/flutter_gamepads/README.md b/packages/flutter_gamepads/README.md index 688ea7c6..87f3652e 100644 --- a/packages/flutter_gamepads/README.md +++ b/packages/flutter_gamepads/README.md @@ -110,7 +110,7 @@ within a Tick-tac-toe game is in [TicTacToe widget](https://github.com/flame-eng There are four ways to block gamepad input from invoking intents: 1. Omitting the `GamepadControl` widget from your widget tree - - Fully unregisters `gamepad` event handles, axis activation memory, repeat timers etc. + - Fully unregisters *gamepads* event handles, axis activation memory, repeat timers etc. 2. `GamepadControl.ignoreEvents == true` - Early check on each *gamepads* event, axis activation memory is reset and repeat timers are reset. From 8adafb22c7d099fbdd4d8670a4f2b8dc0ba4ae89 Mon Sep 17 00:00:00 2001 From: Lisette Linse Date: Fri, 10 Apr 2026 21:25:01 +0200 Subject: [PATCH 3/3] docs: Change bridge package links to pub.dev links --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bb50ae53..738edce0 100644 --- a/README.md +++ b/README.md @@ -258,11 +258,11 @@ which is statically linked. ## Bridge packages -- [flame_gamepads](https://github.com/flame-engine/flame/tree/main/packages/flame_gamepads) - +- [flame_gamepads](https://pub.dev/packages/flame_gamepads) - Provides a GamepadCallbacks component mixin for your Flame games -- [flutter_gamepads](./packages/flutter_gamepads/) - Provides a widget that maps gamepad input - to UI interaction with your Flutter widgets. In regular Flutter apps as well as for Flame - overlays. +- [flutter_gamepads](https://pub.dev/packages/flutter_gamepads) - Provides a widget that + maps gamepad input to UI interaction with your Flutter widgets. In regular Flutter apps + as well as for Flame overlays. ## Support