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
5a48a416
Unverified
Commit
5a48a416
authored
Aug 04, 2021
by
xubaolin
Committed by
GitHub
Aug 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update some Focus docs (#87561)
parent
536e7a2e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
focus_manager.dart
packages/flutter/lib/src/widgets/focus_manager.dart
+6
-5
focus_scope.dart
packages/flutter/lib/src/widgets/focus_scope.dart
+7
-6
No files found.
packages/flutter/lib/src/widgets/focus_manager.dart
View file @
5a48a416
...
...
@@ -309,11 +309,12 @@ enum UnfocusDisposition {
/// The [FocusManager] receives key events from [RawKeyboard] and
/// [HardwareKeyboard] and will pass them to the focused nodes. It starts with
/// the node with the primary focus, and will call the [onKey] or [onKeyEvent]
/// callback for that node. If the callback returns false, indicating that it did
/// not handle the event, the [FocusManager] will move to the parent of that node
/// and call its [onKey] or [onKeyEvent]. If that [onKey] or [onKeyEvent] returns
/// true, then it will stop propagating the event. If it reaches the root
/// [FocusScopeNode], [FocusManager.rootScope], the event is discarded.
/// callback for that node. If the callback returns [KeyEventResult.ignored],
/// indicating that it did not handle the event, the [FocusManager] will move
/// to the parent of that node and call its [onKey] or [onKeyEvent]. If that
/// [onKey] or [onKeyEvent] returns [KeyEventResult.handled], then it will stop
/// propagating the event. If it reaches the root [FocusScopeNode],
/// [FocusManager.rootScope], the event is discarded.
/// {@endtemplate}
///
/// ## Focus Traversal
...
...
packages/flutter/lib/src/widgets/focus_scope.dart
View file @
5a48a416
...
...
@@ -16,7 +16,7 @@ import 'inherited_notifier.dart';
///
/// For keyboard events, [onKey] is called if [FocusNode.hasFocus] is true for
/// this widget's [focusNode], unless a focused descendant's [onKey] callback
/// returns
true
when called.
/// returns
[KeyEventResult.handled]
when called.
///
/// This widget does not provide any visual indication that the focus has
/// changed. Any desired visual changes should be made when [onFocusChange] is
...
...
@@ -316,9 +316,9 @@ class Focus extends StatefulWidget {
/// focus.
///
/// Key events are first given to the [FocusNode] that has primary focus, and
/// if its [onKeyEvent] method return
false, then they are given to each
///
ancestor node up the focus hierarchy in turn. If an event reaches the roo
t
/// of the hierarchy, it is discarded.
/// if its [onKeyEvent] method return
s [KeyEventResult.ignored], then they are
///
given to each ancestor node up the focus hierarchy in turn. If an even
t
///
reaches the root
of the hierarchy, it is discarded.
///
/// This is not the way to get text input in the manner of a text field: it
/// leaves out support for input method editors, and doesn't support soft
...
...
@@ -742,8 +742,9 @@ class _FocusState extends State<Focus> {
/// The [onKey] argument allows specification of a key event handler that is
/// invoked when this node or one of its children has focus. Keys are handed to
/// the primary focused widget first, and then they propagate through the
/// ancestors of that node, stopping if one of them returns true from [onKey],
/// indicating that it has handled the event.
/// ancestors of that node, stopping if one of them returns
/// [KeyEventResult.handled] from [onKey], indicating that it has handled the
/// event.
///
/// Managing a [FocusScopeNode] means managing its lifecycle, listening for
/// changes in focus, and re-parenting it when needed to keep the focus
...
...
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