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
78885ecb
Unverified
Commit
78885ecb
authored
May 12, 2022
by
Jami Couch
Committed by
GitHub
May 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide default method call handler for SystemChannels.textInput (#101087)
parent
d647755e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
binding.dart
packages/flutter/lib/src/services/binding.dart
+2
-0
text_input.dart
packages/flutter/lib/src/services/text_input.dart
+6
-0
binding_test.dart
packages/flutter/test/services/binding_test.dart
+7
-0
No files found.
packages/flutter/lib/src/services/binding.dart
View file @
78885ecb
...
...
@@ -17,6 +17,7 @@ import 'message_codec.dart';
import
'raw_keyboard.dart'
;
import
'restoration.dart'
;
import
'system_channels.dart'
;
import
'text_input.dart'
;
/// Listens for platform messages and directs them to the [defaultBinaryMessenger].
///
...
...
@@ -36,6 +37,7 @@ mixin ServicesBinding on BindingBase, SchedulerBinding {
SystemChannels
.
system
.
setMessageHandler
((
dynamic
message
)
=>
handleSystemMessage
(
message
as
Object
));
SystemChannels
.
lifecycle
.
setMessageHandler
(
_handleLifecycleMessage
);
SystemChannels
.
platform
.
setMethodCallHandler
(
_handlePlatformMessage
);
TextInput
.
ensureInitialized
();
readInitialLifecycleStateFromNativeWindow
();
}
...
...
packages/flutter/lib/src/services/text_input.dart
View file @
78885ecb
...
...
@@ -1575,6 +1575,12 @@ class TextInput {
TextInputAction
.
emergencyCall
,
];
/// Ensure that a [TextInput] instance has been set up so that the platform
/// can handle messages on the text input method channel.
static
void
ensureInitialized
()
{
_instance
;
// ignore: unnecessary_statements
}
/// Begin interacting with the text input control.
///
/// Calling this function helps multiple clients coordinate about which one is
...
...
packages/flutter/test/services/binding_test.dart
View file @
78885ecb
...
...
@@ -107,4 +107,11 @@ void main() {
await
rootBundle
.
loadString
(
'test_asset2'
);
expect
(
flutterAssetsCallCount
,
4
);
});
test
(
'initInstances sets a default method call handler for SystemChannels.textInput'
,
()
async
{
final
ByteData
message
=
const
JSONMessageCodec
().
encodeMessage
(<
String
,
dynamic
>{
'method'
:
'TextInput.requestElementsInRect'
,
'args'
:
null
})!;
await
ServicesBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
'flutter/textinput'
,
message
,
(
ByteData
?
data
)
{
expect
(
data
,
isNotNull
);
});
});
}
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