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
1793108b
Unverified
Commit
1793108b
authored
Feb 20, 2020
by
Greg Spencer
Committed by
GitHub
Feb 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add additional focus samples. (#50846)
parent
7a83c6fc
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
437 additions
and
94 deletions
+437
-94
text_form_field.dart
packages/flutter/lib/src/material/text_form_field.dart
+48
-0
actions.dart
packages/flutter/lib/src/widgets/actions.dart
+4
-2
focus_manager.dart
packages/flutter/lib/src/widgets/focus_manager.dart
+68
-67
focus_scope.dart
packages/flutter/lib/src/widgets/focus_scope.dart
+311
-22
focus_traversal.dart
packages/flutter/lib/src/widgets/focus_traversal.dart
+6
-3
No files found.
packages/flutter/lib/src/material/text_form_field.dart
View file @
1793108b
...
...
@@ -62,6 +62,54 @@ export 'package:flutter/services.dart' show SmartQuotesType, SmartDashesType;
/// ```
/// {@end-tool}
///
/// {@tool dartpad --template=stateful_widget_material}
/// This example shows how to move the focus to the next field when the user
/// presses the ENTER key.
///
/// ```dart imports
/// import 'package:flutter/services.dart';
/// ```
///
/// ```dart
/// Widget build(BuildContext context) {
/// return Material(
/// child: Center(
/// child: Shortcuts(
/// shortcuts: <LogicalKeySet, Intent>{
/// // Pressing enter on the field will now move to the next field.
/// LogicalKeySet(LogicalKeyboardKey.enter):
/// Intent(NextFocusAction.key),
/// },
/// child: FocusTraversalGroup(
/// child: Form(
/// autovalidate: true,
/// onChanged: () {
/// Form.of(primaryFocus.context).save();
/// },
/// child: Wrap(
/// children: List<Widget>.generate(5, (int index) {
/// return Padding(
/// padding: const EdgeInsets.all(8.0),
/// child: ConstrainedBox(
/// constraints: BoxConstraints.tight(Size(200, 50)),
/// child: TextFormField(
/// onSaved: (String value) {
/// print('Value for field $index saved as "$value"');
/// },
/// ),
/// ),
/// );
/// }),
/// ),
/// ),
/// ),
/// ),
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
/// See also:
///
/// * <https://material.io/design/components/text-fields.html>
...
...
packages/flutter/lib/src/widgets/actions.dart
View file @
1793108b
...
...
@@ -374,12 +374,14 @@ class Actions extends InheritedWidget {
/// {@tool dartpad --template=stateful_widget_material}
/// This example shows how keyboard interaction can be added to a custom control
/// that changes color when hovered and focused, and can toggle a light when
/// activated, either by touch or by hitting the `X` key on the keyboard.
/// activated, either by touch or by hitting the `X` key on the keyboard when
/// the "And Me" button has the keyboard focus (be sure to use TAB to move the
/// focus to the "And Me" button before trying it out).
///
/// This example defines its own key binding for the `X` key, but in this case,
/// there is also a default key binding for [ActivateAction] in the default key
/// bindings created by [WidgetsApp] (the parent for [MaterialApp], and
/// [CupertinoApp]), so the `ENTER` key will also activate the
control
.
/// [CupertinoApp]), so the `ENTER` key will also activate the
buttons
.
///
/// ```dart imports
/// import 'package:flutter/services.dart';
...
...
packages/flutter/lib/src/widgets/focus_manager.dart
View file @
1793108b
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/widgets/focus_scope.dart
View file @
1793108b
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/widgets/focus_traversal.dart
View file @
1793108b
...
...
@@ -951,8 +951,8 @@ class _ReadingOrderDirectionalGroupData extends Diagnosticable {
/// 3. Pick the closest to the beginning of the reading order from among the
/// nodes discovered above.
///
/// It uses the ambient [Directionality] in the context for the enclosing
scope
/// to determine which direction is "reading order".
/// It uses the ambient [Directionality] in the context for the enclosing
///
[FocusTraversalGroup]
to determine which direction is "reading order".
///
/// See also:
///
...
...
@@ -1296,11 +1296,14 @@ class _OrderedFocusInfo {
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [WidgetOrderFocusTraversalPolicy], a policy that relies on the widget
/// * [FocusTraversalGroup], a widget that groups together and imposes a
/// traversal policy on the [Focus] nodes below it in the widget hierarchy.
/// * [WidgetOrderTraversalPolicy], a policy that relies on the widget
/// creation order to describe the order of traversal.
/// * [ReadingOrderTraversalPolicy], a policy that describes the order as the
/// natural "reading order" for the current [Directionality].
...
...
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