Handle KEYCODE_DPAD_CENTER and KEYCODE_ENTER (#140808)

https://github.com/flutter/flutter/issues/1670

Note: This PR replaces the the original PR (https://github.com/flutter/flutter/pull/138240) that got into a state where a rebase was not possible and made it difficult to determine what was causing unrelated test failures.
This commit is contained in:
Ann Marie Mossman
2024-01-03 10:37:23 -08:00
committed by GitHub
parent d46a8afc1a
commit 743cdd68b7
2 changed files with 6 additions and 0 deletions

View File

@@ -1221,6 +1221,7 @@ class WidgetsApp extends StatefulWidget {
SingleActivator(LogicalKeyboardKey.numpadEnter): ActivateIntent(),
SingleActivator(LogicalKeyboardKey.space): ActivateIntent(),
SingleActivator(LogicalKeyboardKey.gameButtonA): ActivateIntent(),
SingleActivator(LogicalKeyboardKey.select): ActivateIntent(),
// Dismissal
SingleActivator(LogicalKeyboardKey.escape): DismissIntent(),

View File

@@ -146,6 +146,11 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.gameButtonA);
await tester.pumpAndSettle();
expect(checked, isTrue);
checked = false;
await tester.sendKeyEvent(LogicalKeyboardKey.select);
await tester.pumpAndSettle();
expect(checked, isTrue);
// ignore: deprecated_member_use
}, variant: KeySimulatorTransitModeVariant.all());