Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
7467bde4
Unverified
Commit
7467bde4
authored
Feb 05, 2020
by
creativecreatorormaybenot
Committed by
GitHub
Feb 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Gamepad support for the activation action (#49987)
parent
52d5744e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
app.dart
packages/flutter/lib/src/widgets/app.dart
+1
-0
app_test.dart
packages/flutter/test/widgets/app_test.dart
+43
-0
No files found.
packages/flutter/lib/src/widgets/app.dart
View file @
7467bde4
...
...
@@ -847,6 +847,7 @@ class WidgetsApp extends StatefulWidget {
// Activation
LogicalKeySet
(
LogicalKeyboardKey
.
enter
):
const
Intent
(
ActivateAction
.
key
),
LogicalKeySet
(
LogicalKeyboardKey
.
space
):
const
Intent
(
ActivateAction
.
key
),
LogicalKeySet
(
LogicalKeyboardKey
.
gameButtonA
):
const
Intent
(
ActivateAction
.
key
),
// Keyboard traversal.
LogicalKeySet
(
LogicalKeyboardKey
.
tab
):
const
Intent
(
NextFocusAction
.
key
),
...
...
packages/flutter/test/widgets/app_test.dart
View file @
7467bde4
...
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/widgets.dart'
;
...
...
@@ -96,6 +97,48 @@ void main() {
expect
(
action
.
calls
,
equals
(
1
));
});
testWidgets
(
'WidgetsApp default activation key mappings work'
,
(
WidgetTester
tester
)
async
{
bool
checked
=
false
;
await
tester
.
pumpWidget
(
WidgetsApp
(
builder:
(
BuildContext
context
,
Widget
child
)
{
return
Material
(
child:
Checkbox
(
value:
checked
,
autofocus:
true
,
onChanged:
(
bool
value
)
{
checked
=
value
;
},
),
);
},
color:
const
Color
(
0xFF123456
),
),
);
await
tester
.
pump
();
// Test three default buttons for the activation action.
await
tester
.
sendKeyEvent
(
LogicalKeyboardKey
.
space
);
await
tester
.
pumpAndSettle
();
expect
(
checked
,
isTrue
);
// Only space is used as an activation key on web.
if
(
kIsWeb
)
{
return
;
}
checked
=
false
;
await
tester
.
sendKeyEvent
(
LogicalKeyboardKey
.
enter
);
await
tester
.
pumpAndSettle
();
expect
(
checked
,
isTrue
);
checked
=
false
;
await
tester
.
sendKeyEvent
(
LogicalKeyboardKey
.
gameButtonA
);
await
tester
.
pumpAndSettle
();
expect
(
checked
,
isTrue
);
});
group
(
'error control test'
,
()
{
Future
<
void
>
expectFlutterError
({
GlobalKey
<
NavigatorState
>
key
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment