MentionTextEditingController class

Text editing controller that can parse mentions

Inheritance

Constructors

MentionTextEditingController({TextEditingController? controllerToCopyTo, required List<MentionSyntax> mentionSyntaxes, SuggestionCallback? onSuggestionChanged, Color? mentionBgColor, Color? mentionTextColor, TextStyle? mentionTextStyle, TextStyle? runTextStyle, required IdToMentionCallback idToMentionObject, String? text})

Properties

controllerToCopyTo TextEditingController?
EditingController to copy our text to, used for things like the Autocorrect widget
final
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
idToMentionObject IdToMentionCallback
Function to get a mention from an id, used to deconstruct markup on construct
final
mentionBgColor Color?
Background color of the text for the mention
final
mentionSyntaxes List<MentionSyntax>
Unique mention syntaxes, all syntaxes should have a different starting character
final
mentionTextColor Color?
Color of the text for the mention
final
mentionTextStyle TextStyle?
Text style for the mention
final
runTextStyle TextStyle?
Text style for normal non-mention text
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selection TextSelection
The currently selected range within text.
getter/setter pairinherited
text String
The current string the user is editing.
getter/setter pairinherited
value TextEditingValue
The current value stored in this notifier.
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addSuggestionListener(SuggestionCallback callback) → void
Add a suggestion listener.
buildTextSpan({required BuildContext context, TextStyle? style, required bool withComposing}) TextSpan
Builds TextSpan from current editing value.
override
cancelMentioning() → void
Cancel mentioning
clear() → void
Set the value to empty.
inherited
clearComposing() → void
Set the composing region to an empty range.
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
getMarkupText() String
Get the text in the format that is readable by syntaxes. This will contain all text + syntax mentions (i.e. <###@USERID###>)
getSearchSyntax() MentionSyntax?
Get the current search syntax for the current mention. This is useful when you have multiple syntaxes
getSearchText() String
Get the current search string for the mention (this is the mention minus the starting character. i.e. @Amber -> Amber)
insertMention(MentionObject mention) → void
Insert a mention in the currently mentioning position
isMentioning() bool
Check if we are currently mentioning
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeSuggestionListener(SuggestionCallback callback) → void
Remove a suggestion listener.
setMarkupText(BuildContext context, String markupText) Future<void>
Set markup text, this is used when you get data that has the mention syntax and you want to initialize the TextField with it.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited