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
8caa14e6
Unverified
Commit
8caa14e6
authored
Aug 17, 2022
by
LongCatIsLooong
Committed by
GitHub
Aug 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a type casting error in text_input.dart (#109635)
parent
3d94a014
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
text_input.dart
packages/flutter/lib/src/services/text_input.dart
+1
-1
text_input_test.dart
packages/flutter/test/services/text_input_test.dart
+27
-0
No files found.
packages/flutter/lib/src/services/text_input.dart
View file @
8caa14e6
...
...
@@ -1523,7 +1523,7 @@ RawFloatingCursorPoint _toTextPoint(FloatingCursorDragState state, Map<String, d
assert
(
encoded
[
'X'
]
!=
null
,
'You must provide a value for the horizontal location of the floating cursor.'
);
assert
(
encoded
[
'Y'
]
!=
null
,
'You must provide a value for the vertical location of the floating cursor.'
);
final
Offset
offset
=
state
==
FloatingCursorDragState
.
Update
?
Offset
(
encoded
[
'X'
]
as
double
,
encoded
[
'Y'
]
as
double
)
?
Offset
(
(
encoded
[
'X'
]
as
num
).
toDouble
(),
(
encoded
[
'Y'
]
as
num
).
toDouble
()
)
:
Offset
.
zero
;
return
RawFloatingCursorPoint
(
offset:
offset
,
state:
state
);
}
...
...
packages/flutter/test/services/text_input_test.dart
View file @
8caa14e6
...
...
@@ -241,6 +241,33 @@ void main() {
expect
(
record
[
0
].
exception
.
toString
(),
matches
(
RegExp
(
r'\brange.start >= 0 && range.start <= text.length\b'
)));
expect
(
record
[
0
].
exception
.
toString
(),
matches
(
RegExp
(
r'\bRange start 2 is out of text of length 1\b'
)));
});
test
(
'FloatingCursor coordinates type-casting'
,
()
async
{
// Regression test for https://github.com/flutter/flutter/issues/109632.
final
List
<
FlutterErrorDetails
>
errors
=
<
FlutterErrorDetails
>[];
FlutterError
.
onError
=
errors
.
add
;
final
FakeTextInputClient
client
=
FakeTextInputClient
(
const
TextEditingValue
(
text:
'test3'
));
const
TextInputConfiguration
configuration
=
TextInputConfiguration
();
TextInput
.
attach
(
client
,
configuration
);
final
ByteData
?
messageBytes
=
const
JSONMessageCodec
().
encodeMessage
(<
String
,
dynamic
>{
'method'
:
'TextInputClient.updateFloatingCursor'
,
'args'
:
<
dynamic
>[
-
1
,
'FloatingCursorDragState.update'
,
<
String
,
dynamic
>{
'X'
:
2
,
'Y'
:
3
},
],
});
await
ServicesBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
'flutter/textinput'
,
messageBytes
,
(
ByteData
?
_
)
{},
);
expect
(
errors
,
isEmpty
);
});
});
group
(
'TextInputConfiguration'
,
()
{
...
...
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