public class TextInputChannel extends Object
TextInputChannel
is a platform channel between Android and Flutter that is used to
communicate information about the user's text input.
When the user presses an action button like "done" or "next", that action is sent from Android
to Flutter through this TextInputChannel
.
When an input system in the Flutter app wants to show the keyboard, or hide it, or configure
editing state, etc. a message is sent from Flutter to Android through this TextInputChannel
.
TextInputChannel
comes with a default MethodChannel.MethodCallHandler
that parses incoming messages from
Flutter. Register a TextInputChannel.TextInputMethodHandler
to respond to standard Flutter text input
messages.
Modifier and Type | Class and Description |
---|---|
static class |
TextInputChannel.Configuration
A text editing configuration.
|
static class |
TextInputChannel.InputType
A text input type.
|
static class |
TextInputChannel.TextCapitalization
Text capitalization schemes.
|
static class |
TextInputChannel.TextEditState
State of an on-going text editing session.
|
static interface |
TextInputChannel.TextInputMethodHandler |
static class |
TextInputChannel.TextInputType
Types of text input.
|
Modifier and Type | Field and Description |
---|---|
MethodChannel |
channel |
Constructor and Description |
---|
TextInputChannel(DartExecutor dartExecutor)
Constructs a
TextInputChannel that connects Android to the Dart code running in dartExecutor . |
Modifier and Type | Method and Description |
---|---|
void |
done(int inputClientId)
Instructs Flutter to execute a "done" action.
|
void |
go(int inputClientId)
Instructs Flutter to execute a "go" action.
|
void |
newline(int inputClientId)
Instructs Flutter to execute a "newline" action.
|
void |
next(int inputClientId)
Instructs Flutter to execute a "next" action.
|
void |
performPrivateCommand(int inputClientId,
String action,
Bundle data) |
void |
previous(int inputClientId)
Instructs Flutter to execute a "previous" action.
|
void |
requestExistingInputState()
Instructs Flutter to reattach the last active text input client, if any.
|
void |
search(int inputClientId)
Instructs Flutter to execute a "search" action.
|
void |
send(int inputClientId)
Instructs Flutter to execute a "send" action.
|
void |
setTextInputMethodHandler(TextInputChannel.TextInputMethodHandler textInputMethodHandler)
Sets the
TextInputChannel.TextInputMethodHandler which receives all events and requests that are parsed
from the underlying platform channel. |
void |
unspecifiedAction(int inputClientId)
Instructs Flutter to execute an "unspecified" action.
|
void |
updateEditingState(int inputClientId,
String text,
int selectionStart,
int selectionEnd,
int composingStart,
int composingEnd)
Instructs Flutter to update its text input editing state to reflect the given configuration.
|
void |
updateEditingStateWithTag(int inputClientId,
HashMap<String,TextInputChannel.TextEditState> editStates) |
@NonNull public final MethodChannel channel
public TextInputChannel(@NonNull DartExecutor dartExecutor)
TextInputChannel
that connects Android to the Dart code running in dartExecutor
.
The given dartExecutor
is permitted to be idle or executing code.
See DartExecutor
.
public void requestExistingInputState()
This is necessary when the view heirarchy has been detached and reattached to a FlutterEngine
, as the engine may have kept alive a text editing client on the Dart side.
public void updateEditingState(int inputClientId, String text, int selectionStart, int selectionEnd, int composingStart, int composingEnd)
public void updateEditingStateWithTag(int inputClientId, HashMap<String,TextInputChannel.TextEditState> editStates)
public void newline(int inputClientId)
public void go(int inputClientId)
public void search(int inputClientId)
public void send(int inputClientId)
public void done(int inputClientId)
public void next(int inputClientId)
public void previous(int inputClientId)
public void unspecifiedAction(int inputClientId)
public void performPrivateCommand(int inputClientId, String action, Bundle data)
public void setTextInputMethodHandler(@Nullable TextInputChannel.TextInputMethodHandler textInputMethodHandler)
TextInputChannel.TextInputMethodHandler
which receives all events and requests that are parsed
from the underlying platform channel.