SpannedTextEditingController class
A TextEditingController with rich text capabilities.
- Implemented types
- Available extensions
Constructors
- SpannedTextEditingController.new({TextAttribute? compositionAttribute, ProcessTextValue processTextValue = _defaultProcessTextValue, String? text, SpanList? spans, bool hasMarkerCharacters = false})
- Create a new SpannedTextEditingController.
Properties
- compositionAttribute → TextAttribute
-
The attribute that's applied to the active composition.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setteroverride
- hasMarkerCharacters → bool
-
Whether the content of this controller uses marker characters.
final
- processTextValue → ProcessTextValue
-
Used to process value whenever it changes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selection ↔ TextSelection
-
The currently selected range within text.
getter/setter pairoverride
- selectionRange → Range
-
Get the selection as a Range. Selection must be valid.
no setter
- spannedString ↔ SpannedString
-
Get the rich text contents managed by this controller.
getter/setter pair
- spans ↔ SpanList
-
Get the list of spans that determine the formatting of the text.
getter/setter pair
- text ↔ String
-
The current string the user is editing.
getter/setter pairoverride
- value ↔ TextEditingValue
-
The current value stored in this notifier.
getter/setter pairoverride
Methods
-
addListener(
void listener()) → void -
Register a closure to be called when the object changes.
override
-
applyAttribute(
TextAttribute attribute) → void -
Available on SpannedTextEditingController, provided by the SpannedTextEditingControllerExtension extension
Apply an attribute to the current selection. -
buildTextSpan(
{required BuildContext context, TextStyle? style, required bool withComposing}) → TextSpan -
Builds TextSpan from current editing value.
override
-
clear(
) → void -
Set the value to empty.
override
-
clearComposing(
) → void -
Set the composing region to an empty range.
override
-
copy(
) → SpannedTextEditingController - Create a new spanned text editing controller with the same state as this one.
-
copyWith(
{TextAttribute? compositionAttribute, ProcessTextValue? processTextValue, String? text, SpanList? spans, bool? hasMarkerCharacters}) → SpannedTextEditingController - Create a new spanned text editing controller with the same state as this one, but with the given fields replaced with the new values.
-
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
-
getAppliedSpansWithType<
T extends TextAttribute> () → Iterable< AttributeSpan> -
Available on SpannedTextEditingController, provided by the SpannedTextEditingControllerExtension extension
Get all attribute spans of typeT
applied to the current selection. -
getAppliedSpansWithUnsafeType(
Type type) → Iterable< AttributeSpan> -
Available on SpannedTextEditingController, provided by the SpannedTextEditingControllerExtension extension
Get all attribute spans of typetype
applied to the current selection. -
isApplied(
TextAttribute attribute) → bool -
Available on SpannedTextEditingController, provided by the SpannedTextEditingControllerExtension extension
Determines ifattribute
is applied to the full selection (for a ranged selection) or would be applied on insertion (for a collapsed selection). -
isSelectionWithinTextBounds(
TextSelection selection) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
override
-
removeListener(
void listener()) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
override
-
setOverride(
TextAttribute attribute, OverrideType type) → void - Override whether or not an attribute will be applied on the next insertion.
-
toggleAttribute(
TextAttribute attribute) → bool -
Available on SpannedTextEditingController, provided by the SpannedTextEditingControllerExtension extension
Toggle an attribute for the current selection. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
diffStrings(
String oldText, String newText, int cursor) → StringDiff -
Diff two strings under the assumption that at most one insertion and one
deletion took place, and both happened at the same index, after which the
cursor was at index
cursor
in the new string.