Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Public Attributes | Package Attributes | List of all members
io.flutter.embedding.engine.systemchannels.TextInputChannel Class Reference

Classes

class  Configuration
 
class  InputType
 
enum  TextCapitalization
 
class  TextEditState
 
interface  TextInputMethodHandler
 
enum  TextInputType
 

Public Member Functions

 TextInputChannel (@NonNull DartExecutor dartExecutor)
 
void requestExistingInputState ()
 
void updateEditingState (int inputClientId, @NonNull String text, int selectionStart, int selectionEnd, int composingStart, int composingEnd)
 
void updateEditingStateWithDeltas (int inputClientId, @NonNull ArrayList< TextEditingDelta > batchDeltas)
 
void updateEditingStateWithTag (int inputClientId, @NonNull HashMap< String, TextEditState > editStates)
 
void newline (int inputClientId)
 
void go (int inputClientId)
 
void search (int inputClientId)
 
void send (int inputClientId)
 
void done (int inputClientId)
 
void next (int inputClientId)
 
void previous (int inputClientId)
 
void unspecifiedAction (int inputClientId)
 
void commitContent (int inputClientId, Map< String, Object > content)
 
void performPrivateCommand (int inputClientId, @NonNull String action, @NonNull Bundle data)
 
void setTextInputMethodHandler (@Nullable TextInputMethodHandler textInputMethodHandler)
 

Public Attributes

final MethodChannel channel
 

Package Attributes

final MethodChannel.MethodCallHandler parsingMethodHandler
 

Detailed Description

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 io.flutter.plugin.common.MethodChannel.MethodCallHandler that parses incoming messages from Flutter. Register a TextInputMethodHandler to respond to standard Flutter text input messages.

Definition at line 44 of file TextInputChannel.java.

Constructor & Destructor Documentation

◆ TextInputChannel()

io.flutter.embedding.engine.systemchannels.TextInputChannel.TextInputChannel ( @NonNull DartExecutor  dartExecutor)
inline

Constructs a TextInputChannel that connects Android to the Dart code running in
dartExecutor
.

The given dartExecutor is permitted to be idle or executing code.

See DartExecutor.

Definition at line 168 of file TextInputChannel.java.

168 {
169 this.channel = new MethodChannel(dartExecutor, "flutter/textinput", JSONMethodCodec.INSTANCE);
171 }
final MethodChannel.MethodCallHandler parsingMethodHandler
void setMethodCallHandler(final @Nullable MethodCallHandler handler)

Member Function Documentation

◆ commitContent()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.commitContent ( int  inputClientId,
Map< String, Object >  content 
)
inline

Instructs Flutter to commit inserted content back to the text channel.

Definition at line 332 of file TextInputChannel.java.

332 {
333 Log.v(TAG, "Sending 'commitContent' message.");
335 "TextInputClient.performAction",
336 Arrays.asList(inputClientId, "TextInputAction.commitContent", content));
337 }
void invokeMethod(@NonNull String method, @Nullable Object arguments)
union flutter::testing::@2836::KeyboardChange::@76 content
void Log(const char *format,...) SK_PRINTF_LIKE(1
Definition: TestRunner.cpp:137

◆ done()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.done ( int  inputClientId)
inline

Instructs Flutter to execute a "done" action.

Definition at line 303 of file TextInputChannel.java.

303 {
304 Log.v(TAG, "Sending 'done' message.");
306 "TextInputClient.performAction", Arrays.asList(inputClientId, "TextInputAction.done"));
307 }

◆ go()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.go ( int  inputClientId)
inline

Instructs Flutter to execute a "go" action.

Definition at line 282 of file TextInputChannel.java.

282 {
283 Log.v(TAG, "Sending 'go' message.");
285 "TextInputClient.performAction", Arrays.asList(inputClientId, "TextInputAction.go"));
286 }

◆ newline()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.newline ( int  inputClientId)
inline

Instructs Flutter to execute a "newline" action.

Definition at line 275 of file TextInputChannel.java.

275 {
276 Log.v(TAG, "Sending 'newline' message.");
278 "TextInputClient.performAction", Arrays.asList(inputClientId, "TextInputAction.newline"));
279 }

◆ next()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.next ( int  inputClientId)
inline

Instructs Flutter to execute a "next" action.

Definition at line 310 of file TextInputChannel.java.

310 {
311 Log.v(TAG, "Sending 'next' message.");
313 "TextInputClient.performAction", Arrays.asList(inputClientId, "TextInputAction.next"));
314 }

◆ performPrivateCommand()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.performPrivateCommand ( int  inputClientId,
@NonNull String  action,
@NonNull Bundle  data 
)
inline

Definition at line 339 of file TextInputChannel.java.

340 {
341 HashMap<Object, Object> json = new HashMap<>();
342 json.put("action", action);
343 if (data != null) {
344 HashMap<String, Object> dataMap = new HashMap<>();
345 Set<String> keySet = data.keySet();
346 for (String key : keySet) {
347 Object value = data.get(key);
348 if (value instanceof byte[]) {
349 dataMap.put(key, data.getByteArray(key));
350 } else if (value instanceof Byte) {
351 dataMap.put(key, data.getByte(key));
352 } else if (value instanceof char[]) {
353 dataMap.put(key, data.getCharArray(key));
354 } else if (value instanceof Character) {
355 dataMap.put(key, data.getChar(key));
356 } else if (value instanceof CharSequence[]) {
357 dataMap.put(key, data.getCharSequenceArray(key));
358 } else if (value instanceof CharSequence) {
359 dataMap.put(key, data.getCharSequence(key));
360 } else if (value instanceof float[]) {
361 dataMap.put(key, data.getFloatArray(key));
362 } else if (value instanceof Float) {
363 dataMap.put(key, data.getFloat(key));
364 }
365 }
366 json.put("data", dataMap);
367 }
369 "TextInputClient.performPrivateCommand", Arrays.asList(inputClientId, json));
370 }
uint8_t value
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ previous()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.previous ( int  inputClientId)
inline

Instructs Flutter to execute a "previous" action.

Definition at line 317 of file TextInputChannel.java.

317 {
318 Log.v(TAG, "Sending 'previous' message.");
320 "TextInputClient.performAction", Arrays.asList(inputClientId, "TextInputAction.previous"));
321 }

◆ requestExistingInputState()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.requestExistingInputState ( )
inline

Instructs Flutter to reattach the last active text input client, if any.

This is necessary when the view hierarchy has been detached and reattached to a io.flutter.embedding.engine.FlutterEngine, as the engine may have kept alive a text editing client on the Dart side.

Definition at line 180 of file TextInputChannel.java.

180 {
181 channel.invokeMethod("TextInputClient.requestExistingInputState", null);
182 }

◆ search()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.search ( int  inputClientId)
inline

Instructs Flutter to execute a "search" action.

Definition at line 289 of file TextInputChannel.java.

289 {
290 Log.v(TAG, "Sending 'search' message.");
292 "TextInputClient.performAction", Arrays.asList(inputClientId, "TextInputAction.search"));
293 }

◆ send()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.send ( int  inputClientId)
inline

Instructs Flutter to execute a "send" action.

Definition at line 296 of file TextInputChannel.java.

296 {
297 Log.v(TAG, "Sending 'send' message.");
299 "TextInputClient.performAction", Arrays.asList(inputClientId, "TextInputAction.send"));
300 }

◆ setTextInputMethodHandler()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.setTextInputMethodHandler ( @Nullable TextInputMethodHandler  textInputMethodHandler)
inline

Sets the TextInputMethodHandler which receives all events and requests that are parsed from the underlying platform channel.

Definition at line 376 of file TextInputChannel.java.

376 {
377 this.textInputMethodHandler = textInputMethodHandler;
378 }

◆ unspecifiedAction()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.unspecifiedAction ( int  inputClientId)
inline

Instructs Flutter to execute an "unspecified" action.

Definition at line 324 of file TextInputChannel.java.

324 {
325 Log.v(TAG, "Sending 'unspecified' message.");
327 "TextInputClient.performAction",
328 Arrays.asList(inputClientId, "TextInputAction.unspecified"));
329 }

◆ updateEditingState()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.updateEditingState ( int  inputClientId,
@NonNull String  text,
int  selectionStart,
int  selectionEnd,
int  composingStart,
int  composingEnd 
)
inline

Instructs Flutter to update its text input editing state to reflect the given configuration.

Definition at line 209 of file TextInputChannel.java.

215 {
216 Log.v(
217 TAG,
218 "Sending message to update editing state: \n"
219 + "Text: "
220 + text
221 + "\n"
222 + "Selection start: "
223 + selectionStart
224 + "\n"
225 + "Selection end: "
226 + selectionEnd
227 + "\n"
228 + "Composing start: "
229 + composingStart
230 + "\n"
231 + "Composing end: "
232 + composingEnd);
233
234 final HashMap<Object, Object> state =
235 createEditingStateJSON(text, selectionStart, selectionEnd, composingStart, composingEnd);
236
237 channel.invokeMethod("TextInputClient.updateEditingState", Arrays.asList(inputClientId, state));
238 }
AtkStateType state
std::u16string text

◆ updateEditingStateWithDeltas()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.updateEditingStateWithDeltas ( int  inputClientId,
@NonNull ArrayList< TextEditingDelta batchDeltas 
)
inline

Definition at line 240 of file TextInputChannel.java.

241 {
242
243 Log.v(
244 TAG,
245 "Sending message to update editing state with deltas: \n"
246 + "Number of deltas: "
247 + batchDeltas.size());
248
249 final HashMap<Object, Object> state = createEditingDeltaJSON(batchDeltas);
250
252 "TextInputClient.updateEditingStateWithDeltas", Arrays.asList(inputClientId, state));
253 }

◆ updateEditingStateWithTag()

void io.flutter.embedding.engine.systemchannels.TextInputChannel.updateEditingStateWithTag ( int  inputClientId,
@NonNull HashMap< String, TextEditState editStates 
)
inline

Definition at line 255 of file TextInputChannel.java.

256 {
257 Log.v(
258 TAG,
259 "Sending message to update editing state for "
260 + String.valueOf(editStates.size())
261 + " field(s).");
262
263 final HashMap<String, HashMap<Object, Object>> json = new HashMap<>();
264 for (Map.Entry<String, TextEditState> element : editStates.entrySet()) {
265 final TextEditState state = element.getValue();
266 json.put(
267 element.getKey(),
268 createEditingStateJSON(state.text, state.selectionStart, state.selectionEnd, -1, -1));
269 }
271 "TextInputClient.updateEditingStateWithTag", Arrays.asList(inputClientId, json));
272 }

Member Data Documentation

◆ channel

final MethodChannel io.flutter.embedding.engine.systemchannels.TextInputChannel.channel

Definition at line 47 of file TextInputChannel.java.

◆ parsingMethodHandler

final MethodChannel.MethodCallHandler io.flutter.embedding.engine.systemchannels.TextInputChannel.parsingMethodHandler
package

Definition at line 51 of file TextInputChannel.java.


The documentation for this class was generated from the following file: