Commit e6a65af
authored
Directional focus edge traversal behavior. (flutter#161285)
Fixes: flutter#160843
This PR adds edge behavior feature for traversing focus using arrow
keys. This allows cycling through the focus within the `FocusScope` in a
closed loop using the arrow keys. Which may be needed by TV application
developers.
Additionally, as in case flutter#160843, `TraversalEdgeBehavior.parentScope`
can be used to allow nested Navigators to traverse focus beyond the
Navigator using arrow keys.
```dart
MaterialApp(
home: Column(
children: <Widget>[
makeFocus(0),
Navigator(
onGenerateRoute: (RouteSettings settings) {
return MaterialPageRoute<void>(
traversalDirectionedEdgeBehavior: TraversalEdgeBehavior.parentScope,
builder: (BuildContext context) {
return Column(
children: <Widget>[
makeFocus(1),
makeFocus(2),
],
);
},
);
},
),
makeFocus(3),
],
),
);
```
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md1 parent f039697 commit e6a65af
File tree
9 files changed
+696
-130
lines changed- packages/flutter
- lib/src
- material
- widgets
- test/widgets
9 files changed
+696
-130
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1358 | 1358 | | |
1359 | 1359 | | |
1360 | 1360 | | |
| 1361 | + | |
1361 | 1362 | | |
1362 | 1363 | | |
1363 | 1364 | | |
| |||
1374 | 1375 | | |
1375 | 1376 | | |
1376 | 1377 | | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
1377 | 1385 | | |
1378 | 1386 | | |
1379 | 1387 | | |
| |||
0 commit comments