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
fb3f1237
Unverified
Commit
fb3f1237
authored
Nov 19, 2021
by
Taha Tesser
Committed by
GitHub
Nov 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CupertinoTextField] Add missing focus listener (#93875)
parent
bde9f118
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
text_field.dart
packages/flutter/lib/src/cupertino/text_field.dart
+1
-0
text_field_test.dart
packages/flutter/test/cupertino/text_field_test.dart
+30
-0
No files found.
packages/flutter/lib/src/cupertino/text_field.dart
View file @
fb3f1237
...
...
@@ -880,6 +880,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with Restoratio
_createLocalController
();
}
_effectiveFocusNode
.
canRequestFocus
=
widget
.
enabled
??
true
;
_effectiveFocusNode
.
addListener
(
_handleFocusChanged
);
}
@override
...
...
packages/flutter/test/cupertino/text_field_test.dart
View file @
fb3f1237
...
...
@@ -284,6 +284,36 @@ void main() {
skip:
kIsWeb
,
// [intended] the web handles this on its own.
);
testWidgets
(
'can get text selection color initially on desktop'
,
(
WidgetTester
tester
)
async
{
final
FocusNode
focusNode
=
FocusNode
();
final
TextEditingController
controller
=
TextEditingController
(
text:
'blah1 blah2'
,
);
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
Center
(
child:
RepaintBoundary
(
child:
CupertinoTextField
(
key:
const
ValueKey
<
int
>(
1
),
controller:
controller
,
focusNode:
focusNode
,
),
),
),
),
);
controller
.
selection
=
const
TextSelection
(
baseOffset:
0
,
extentOffset:
11
);
focusNode
.
requestFocus
();
await
tester
.
pump
();
expect
(
focusNode
.
hasFocus
,
true
);
await
expectLater
(
find
.
byKey
(
const
ValueKey
<
int
>(
1
)),
matchesGoldenFile
(
'text_field_golden.text_selection_color.0.png'
),
);
});
testWidgets
(
'Activates the text field when receives semantics focus on Mac'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
final
SemanticsOwner
semanticsOwner
=
tester
.
binding
.
pipelineOwner
.
semanticsOwner
!;
...
...
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