ImeAttributedTextEditingController class
An AttributedTextEditingController that integrates the platform's Input Method Engine (IME) changes into the text, selection, and composing region of a text field's content.
On mobile, all user input must pass through the platform IME, therefore this integration is required for any mobile text field. On desktop, an app developer can choose between the IME and direct keyboard interaction. An app developer can use this controller on desktop to reflect IME changes, just like on mobile. By using the IME on desktop, apps gain access to auto-correction and language composition features.
Rather than re-implement all of AttributedTextEditingController, ImeAttributedTextEditingController wraps another AttributedTextEditingController and defers to that controller wherever possible.
By default, an ImeAttributedTextEditingController is not connected to the platform
IME. To connect to the IME, call attachToIme
. To detach from the IME, call
detachFromIme
.
- Inheritance
-
- Object
- AttributedTextEditingController
- ImeAttributedTextEditingController
- Mixed-in types
Constructors
- ImeAttributedTextEditingController({AttributedTextEditingController? controller, bool disposeClientController = true, void onIOSFloatingCursorChange(RawFloatingCursorPoint)?, Brightness keyboardAppearance = Brightness.light, TextInputConnectionFactory? inputConnectionFactory, void onPerformSelector(String selectorName)?})
Properties
-
composingAttributions
↔ Set<
Attribution> -
Attributions that will be applied to the next inserted character(s).
getter/setter pairoverride
- composingRegion ↔ TextRange
-
getter/setter pairoverride
- currentAutofillScope → AutofillScope?
-
The AutofillScope this TextInputClient belongs to, if any.
no setteroverride
- currentTextEditingValue → TextEditingValue?
-
The current state of the TextEditingValue held by this client.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- innerController → AttributedTextEditingController
-
no setter
-
inputConnectionNotifier
→ ValueListenable<
TextInputConnection?> -
Notifies whenever the current TextInputConnection changes.
no setter
- isAttachedToIme → bool
-
no setter
- keyboardAppearance → Brightness
-
The appearance of the software keyboard.
no setter
- onIOSFloatingCursorChange ← void Function(RawFloatingCursorPoint)?
-
Sets the callback that's invoked whenever the floating cursor changes
position on iOS.
no getter
- onPerformActionPressed ↔ dynamic Function(TextInputAction)?
-
getter/setter pair
- onPerformSelector ↔ void Function(String selectorName)?
-
Handles a selector generated by the IME.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selection ↔ TextSelection
-
getter/setter pairoverride
- text ↔ AttributedText
-
getter/setter pairoverride
Methods
-
addComposingAttributions(
Set< Attribution> attributions) → void -
Adds the given
attributions
to composingAttributions.override -
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
attachToIme(
{bool autocorrect = true, bool enableSuggestions = true, TextInputAction textInputAction = TextInputAction.done, TextInputType textInputType = TextInputType.text}) → void -
attachToImeWithConfig(
TextInputConfiguration configuration) → void -
buildTextSpan(
AttributionStyleBuilder styleBuilder) → TextSpan -
override
-
clear(
) → void -
Clears the text, selection, composing attributions, and composing region.
override
-
clearComposingAttributions(
) → void -
Removes all attributions from composingAttributions.
override
-
clearSelectionAttributions(
) → void -
Removes all attributions from the text that is currently selected.
override
-
clearText(
) → void -
Clears the text, composing attributions, composing region, and moves
the collapsed selection to the start of the now empty text controller.
override
-
clearTextAndSelection(
) → void -
Clears the text, selection, composing attributions, and composing region.
override
-
connectionClosed(
) → void -
Platform notified framework of closed connection.
override
-
copySelectedTextToClipboard(
) → void -
override
-
delete(
{required int from, required int to, TextSelection? newSelection, TextRange? newComposingRegion}) → void -
Removes the text between
from
(inclusive) andto
(exclusive).override -
deleteCharacter(
TextAffinity direction) → void -
override
-
deleteNextCharacter(
{TextRange? newComposingRegion}) → void -
Deletes the character after the currently collapsed selection.
override
-
deletePreviousCharacter(
{TextRange? newComposingRegion}) → void -
Deletes the character before the currently collapsed selection and
moves selection upstream by one character.
override
-
deleteSelectedText(
) → void -
override
-
deleteSelection(
{TextRange? newComposingRegion}) → void -
Deletes the text within the current selection.
override
-
deleteTextOnLineAfterCaret(
{required ProseTextLayout textLayout}) → void -
inherited
-
deleteTextOnLineBeforeCaret(
{required ProseTextLayout textLayout}) → void -
override
-
detachFromIme(
) → void -
didChangeInputControl(
TextInputControl? oldControl, TextInputControl? newControl) → void -
The framework calls this method to notify that the text input control has
been changed.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
hideKeyboard(
) → void -
insert(
{required AttributedText newText, required int insertIndex, TextSelection? newSelection, TextRange? newComposingRegion}) → void -
Inserts
newText
, starting at the giveninsertIndex
.override -
insertAtCaret(
{required String text, TextRange? newComposingRegion}) → void -
Inserts the given
text
at the current caret position.override -
insertAtCaretUnstyled(
{required String text, TextRange? newComposingRegion}) → void -
Inserts the given
text
at the current caret position without any attributions applied to thetext
.override -
insertAtCaretWithUpstreamAttributions(
{required String text, TextRange? newComposingRegion}) → void -
Inserts the given
text
at the current caret position, extending whatever attributions exist at the offset before the insertion.override -
insertAttributedTextAtCaret(
{required AttributedText attributedText, TextRange? newComposingRegion}) → void -
Inserts the given
attributedText
at the current caret position.override -
insertCharacter(
String character) → void -
override
-
insertContent(
KeyboardInsertedContent content) → void -
Notify client about new content insertion from Android keyboard.
inherited
-
insertNewline(
) → void -
override
-
insertTextPlaceholder(
Size size) → void -
Requests that the client add a text placeholder to reserve visual space
in the text.
inherited
-
isSelectionWithinTextBounds(
TextSelection selection) → bool -
override
-
moveCaretHorizontally(
{required ProseTextLayout textLayout, required bool expandSelection, required bool moveLeft, required MovementModifier? movementModifier}) → void -
override
-
moveCaretVertically(
{required ProseTextLayout textLayout, required bool expandSelection, required bool moveUp}) → void -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
pasteClipboard(
) → Future< void> -
override
-
performAction(
TextInputAction action) → void -
Requests that this client perform the given action.
override
-
performPrivateCommand(
String action, Map< String, dynamic> data) → void -
Request from the input method that this client perform the given private
command.
override
-
performSelector(
String selectorName) → void -
Performs the specified MacOS-specific selector from the
NSStandardKeyBindingResponding
protocol or user-specified selector fromDefaultKeyBinding.Dict
.override -
removeComposingAttributions(
Set< Attribution> attributions) → void -
Removes the given
attributions
from composingAttributions.override -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
removeTextPlaceholder(
) → void -
Requests that the client remove the text placeholder.
inherited
-
replace(
{required AttributedText newText, required int from, required int to, TextSelection? newSelection, TextRange? newComposingRegion}) → void -
Removes the text between
from
(inclusive) andto
(exclusive), and replaces that text withnewText
.override -
replaceSelectionWithAttributedText(
{required AttributedText attributedReplacementText, TextRange? newComposingRegion}) → void -
Replaces the currently selected text with
attributedReplacementText
and collapses the selection at the end ofattributedReplacementText
.override -
replaceSelectionWithTextAndUpstreamAttributions(
{required String replacementText, TextRange? newComposingRegion}) → void -
Replaces the currently selected text with
replacementText
and collapses the selection at the end ofreplacementText
.override -
replaceSelectionWithUnstyledText(
{required String replacementText, TextRange? newComposingRegion}) → void -
Replaces the currently selected text with un-styled text and collapses
the selection at the end of the text.
override
-
selectAll(
) → void -
override
-
showAutocorrectionPromptRect(
int start, int end) → void -
Requests that this client display a prompt rectangle for the given text range,
to indicate the range of text that will be changed by a pending autocorrection.
override
-
showKeyboard(
) → void -
showToolbar(
) → void -
Requests that the client show the editing toolbar, for example when the
platform changes the selection through a non-flutter method such as
scribble.
inherited
-
toggleComposingAttributions(
Set< Attribution> attributions) → void -
Toggles the presence of each of the given
attributions
within the composingAttributions.override -
toggleKeyboard(
) → void -
toggleSelectionAttributions(
List< Attribution> attributions) → void -
Toggles the presence of each of the given
attributions
within the text in the selection.override -
toString(
) → String -
A string representation of this object.
inherited
-
update(
{AttributedText? text, TextSelection? selection, TextRange? composingRegion}) → void -
override
-
updateEditingValue(
TextEditingValue value) → void -
Requests that this client update its editing state to the given value.
override
-
updateEditingValueWithDeltas(
List< TextEditingDelta> deltas) → void -
Requests that this client update its editing state by applying the deltas
received from the engine.
override
-
updateFloatingCursor(
RawFloatingCursorPoint point) → void -
Updates the floating cursor position and state.
override
-
updateTextAndSelection(
{required AttributedText text, required TextSelection selection}) → void -
override
-
updateTextInputConfiguration(
{bool autocorrect = true, bool enableSuggestions = true, TextInputAction textInputAction = TextInputAction.done, TextInputType textInputType = TextInputType.text, Brightness keyboardAppearance = Brightness.light, TextCapitalization textCapitalization = TextCapitalization.none}) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited