MentionTextController class
Controller to track the mentions.
For showing mentions in the text see MentionText or MentionWidget.
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
TextEditingValue> - TextEditingController
- MentionTextController
Constructors
-
MentionTextController({required ValueNotifier<
MentionModel?> lastMention, String tag = kAtSymbol, String? text}) - Controller to track the mentions.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
lastMention
→ ValueNotifier<
MentionModel?> -
Last editable mention
final
-
mentions
↔ List<
MentionModel> -
The list of currently detected mentions in the text.
Each time the text is changed, this list is generated anew
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selection ↔ TextSelection
-
The currently selected range within text.
getter/setter pairinherited
- tag ↔ String
-
The tag that will be used to recognize the mentions.
latefinal
- 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
-
buildTextSpan(
{required BuildContext context, TextStyle? style, required bool withComposing}) → TextSpan -
Builds TextSpan from current editing value.
inherited
-
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
-
getMentionsListWithoutTag(
{required bool isTextTrimmed, MentionModel? firstMention}) → List< MentionModel> ? - Makes a final list of mentions ready to be sent to the backend. Adds the id's, remove tag symbols and inserts the first mention. The first mention can be inserted if it is, for example, a reply to a comment(with position offset)
-
getTextWithFirstMention(
MentionModel firstMention) → String - If we add first mention to getMentionsListWithoutTag, we should return the correct string already with this mention.
-
insertMention(
MentionData< Object?> mentionModel) → void - Inserts the mention in the place of the current editable mention
-
makeQuerySuggestions(
String query) → String? - If the return value == '', then only the tag was entered, if the value == null, then there are no suggestions. Otherwise all matching suggestions will be returned
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
prepareForEditingMode(
List< MentionModel> mentions) → void -
In edit mode of text field with mentions, it is necessary to call this
method during initialization, where to pass a list of previously set
mentions. This will correctly create the set of mentioned users
_mentionedObject
and the list of current mentionsmentions
. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
replaceLastMentionWithText(
String text) → void - Makes the last mention a plain text.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited