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
57a93419
Unverified
Commit
57a93419
authored
Jan 03, 2020
by
chunhtai
Committed by
GitHub
Jan 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EditableText should not update textinput style when the textinput is … (#47904)
parent
a46d1791
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
7 deletions
+94
-7
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+11
-7
editable_text_test.dart
packages/flutter/test/widgets/editable_text_test.dart
+83
-0
No files found.
packages/flutter/lib/src/widgets/editable_text.dart
View file @
57a93419
...
...
@@ -1172,13 +1172,17 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
}
if
(
widget
.
style
!=
oldWidget
.
style
)
{
final
TextStyle
style
=
widget
.
style
;
_textInputConnection
?.
setStyle
(
fontFamily:
style
.
fontFamily
,
fontSize:
style
.
fontSize
,
fontWeight:
style
.
fontWeight
,
textDirection:
_textDirection
,
textAlign:
widget
.
textAlign
,
);
// The _textInputConnection will pick up the new style when it attaches in
// _openInputConnection.
if
(
_textInputConnection
!=
null
&&
_textInputConnection
.
attached
)
{
_textInputConnection
.
setStyle
(
fontFamily:
style
.
fontFamily
,
fontSize:
style
.
fontSize
,
fontWeight:
style
.
fontWeight
,
textDirection:
_textDirection
,
textAlign:
widget
.
textAlign
,
);
}
}
}
...
...
packages/flutter/test/widgets/editable_text_test.dart
View file @
57a93419
...
...
@@ -513,6 +513,89 @@ void main() {
expect
(
handles
[
1
].
localToGlobal
(
Offset
.
zero
),
const
Offset
(
197.0
,
17.0
));
});
testWidgets
(
'can update style of previous activated EditableText'
,
(
WidgetTester
tester
)
async
{
final
Key
key1
=
UniqueKey
();
final
Key
key2
=
UniqueKey
();
await
tester
.
pumpWidget
(
MediaQuery
(
data:
const
MediaQueryData
(
devicePixelRatio:
1.0
),
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
FocusScope
(
node:
focusScopeNode
,
autofocus:
true
,
child:
Column
(
children:
<
Widget
>[
EditableText
(
key:
key1
,
controller:
TextEditingController
(),
backgroundCursorColor:
Colors
.
grey
,
focusNode:
focusNode
,
style:
const
TextStyle
(
fontSize:
9
),
cursorColor:
cursorColor
,
),
EditableText
(
key:
key2
,
controller:
TextEditingController
(),
backgroundCursorColor:
Colors
.
grey
,
focusNode:
focusNode
,
style:
const
TextStyle
(
fontSize:
9
),
cursorColor:
cursorColor
,
),
],
),
),
),
),
);
await
tester
.
tap
(
find
.
byKey
(
key1
));
await
tester
.
showKeyboard
(
find
.
byKey
(
key1
));
controller
.
text
=
'test'
;
await
tester
.
idle
();
RenderBox
renderEditable
=
tester
.
renderObject
(
find
.
byKey
(
key1
));
expect
(
renderEditable
.
size
.
height
,
9.0
);
// Taps the other EditableText to deactivate the first one.
await
tester
.
tap
(
find
.
byKey
(
key2
));
await
tester
.
showKeyboard
(
find
.
byKey
(
key2
));
// Updates the style.
await
tester
.
pumpWidget
(
MediaQuery
(
data:
const
MediaQueryData
(
devicePixelRatio:
1.0
),
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
FocusScope
(
node:
focusScopeNode
,
autofocus:
true
,
child:
Column
(
children:
<
Widget
>[
EditableText
(
key:
key1
,
controller:
TextEditingController
(),
backgroundCursorColor:
Colors
.
grey
,
focusNode:
focusNode
,
style:
const
TextStyle
(
fontSize:
20
),
cursorColor:
cursorColor
,
),
EditableText
(
key:
key2
,
controller:
TextEditingController
(),
backgroundCursorColor:
Colors
.
grey
,
focusNode:
focusNode
,
style:
const
TextStyle
(
fontSize:
9
),
cursorColor:
cursorColor
,
),
],
),
),
),
),
);
renderEditable
=
tester
.
renderObject
(
find
.
byKey
(
key1
));
expect
(
renderEditable
.
size
.
height
,
20.0
);
expect
(
tester
.
takeException
(),
null
);
});
testWidgets
(
'Multiline keyboard with newline action is requested when maxLines = null'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MediaQuery
(
...
...
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