TagTextEditingController<T> class

A controller for an editable text field that supports tagging behaviour.

Inheritance

Constructors

TagTextEditingController.new({required FutureOr<Iterable<T>> searchTaggables(String prefix, String? query), required Future<T?> buildTaggables(FutureOr<Iterable<T>> taggables), required String toFrontendConverter(T taggable), required String toBackendConverter(T taggable), Map<String, TextStyle?> tagStyles = const {'@' : TextStyle(color: Colors.blue)}})

Properties

backendTextFormat String
Converts the text to the format required by the backend.
no setter
buildTaggables Future<T?> Function(FutureOr<Iterable<T>> taggables)
Builds the list of taggables, if any.
final
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
previousCursorPosition int
The cursor position before the last change.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchTaggables FutureOr<Iterable<T>> Function(String prefix, String? query)
Searches for taggables based on the tag prefix and query.
final
selection TextSelection
The currently selected range within text.
getter/setter pairinherited
tagStyles Map<String, TextStyle?>
A map that maps tag prefixes to text styles.
final
text String
The current string the user is editing.
getter/setter pairinherited
toBackendConverter String Function(T taggable)
Converts a taggable to a string that is stored in the database.
final
toFrontendConverter String Function(T taggable)
Converts a taggable to a string that is displayed to the user.
final
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.
override
clear() → void
Set the value to empty.
override
clearComposing() → void
Set the composing region to an empty range.
inherited
cursorController() → void
A listener that ensures that the cursor is always outside of a tag.
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
ensureWhiteSpaceController() → void
A listener that ensures that there is always whitespace around a tag.
getTagMatchPairs(String text) List<(Match?, Match?)>
Returns a list of pairs of start and end matches of tags in the text.
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
setInitialText(String initialText, FutureOr<T?> backendToTaggable(String prefix, String backendString)) → void
Sets the comment this controller is editing.
taggableUsersTapHandler(String prefix, T taggable) → void
Inserts a taggable into the text field.
tagStringController() → void
A listener that checkes if a tag can be created at the current cursor
toString() String
A string representation of this object.
inherited
updatePreviousCursorPosition() → void
updateTaggables() → void
A listener that searches for taggables based on the current tag prompt.

Operators

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