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
f9b8d688
Unverified
Commit
f9b8d688
authored
Oct 31, 2019
by
Gary Qian
Committed by
GitHub
Oct 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder show and setEditingState calls to the IMM (#43865)
parent
175b3724
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+3
-1
editable_text_test.dart
packages/flutter/test/widgets/editable_text_test.dart
+39
-0
No files found.
packages/flutter/lib/src/widgets/editable_text.dart
View file @
f9b8d688
...
...
@@ -1409,6 +1409,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
keyboardAppearance:
widget
.
keyboardAppearance
,
),
);
_textInputConnection
.
show
();
_updateSizeAndTransform
();
final
TextStyle
style
=
widget
.
style
;
...
...
@@ -1421,8 +1422,9 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
textAlign:
widget
.
textAlign
,
)
..
setEditingState
(
localValue
);
}
else
{
_textInputConnection
.
show
();
}
_textInputConnection
.
show
();
}
void
_closeInputConnectionIfNeeded
()
{
...
...
packages/flutter/test/widgets/editable_text_test.dart
View file @
f9b8d688
...
...
@@ -3413,6 +3413,45 @@ void main() {
throwsAssertionError
,
);
});
testWidgets
(
'input imm channel calls are ordered correctly'
,
(
WidgetTester
tester
)
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
SystemChannels
.
textInput
.
setMockMethodCallHandler
((
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
});
const
String
testText
=
'flutter is the best!'
;
final
TextEditingController
controller
=
TextEditingController
(
text:
testText
);
final
EditableText
et
=
EditableText
(
showSelectionHandles:
true
,
maxLines:
2
,
controller:
controller
,
focusNode:
FocusNode
(),
cursorColor:
Colors
.
red
,
backgroundCursorColor:
Colors
.
blue
,
style:
Typography
(
platform:
TargetPlatform
.
android
).
black
.
subhead
.
copyWith
(
fontFamily:
'Roboto'
),
keyboardType:
TextInputType
.
text
,
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Align
(
alignment:
Alignment
.
topLeft
,
child:
SizedBox
(
width:
100
,
child:
et
,
),
),
));
await
tester
.
showKeyboard
(
find
.
byType
(
EditableText
));
expect
(
log
.
length
,
7
);
// TextInput.show should be before TextInput.setEditingState
final
List
<
String
>
logOrder
=
<
String
>[
'TextInput.setClient'
,
'TextInput.show'
,
'TextInput.setEditableSizeAndTransform'
,
'TextInput.setStyle'
,
'TextInput.setEditingState'
,
'TextInput.setEditingState'
,
'TextInput.show'
];
int
index
=
0
;
for
(
MethodCall
m
in
log
)
{
expect
(
m
.
method
,
logOrder
[
index
]);
index
++;
}
});
}
class
MockTextSelectionControls
extends
Mock
implements
TextSelectionControls
{
...
...
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