FlutterTagger class
Provides tagging capabilities (e.g user mentions and adding hashtags) to a TextField returned from builder.
Listens to controller and activates search context when any trigger character from triggerCharacterAndStyles is detected; sending subsequent text as search query using onSearch.
Search results should be shown in overlay which is animated if animationController is provided.
FlutterTagger maintains tag positions during text editing and allows for formatting of the tags in TextField's text value with tagTextFormatter.
Tags in the TextField are styled with TextStyle for their associated trigger character defined in triggerCharacterAndStyles.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FlutterTagger
Constructors
-
FlutterTagger({Key? key, required Widget overlay, required FlutterTaggerController controller, required FlutterTaggerSearchCallback onSearch, required FlutterTaggerWidgetBuilder builder, EdgeInsetsGeometry padding = EdgeInsets.zero, double overlayHeight = 380, Map<
String, TextStyle> triggerCharacterAndStyles = const {}, OverlayPosition overlayPosition = OverlayPosition.top, void onFormattedTextChanged(String)?, RegExp? searchRegex, RegExp? triggerCharactersRegex, TagTextFormatter? tagTextFormatter, AnimationController? animationController}) -
Creates a FlutterTagger widget.
const
Properties
- animationController → AnimationController?
-
Controller for the overlay's animation.
final
- builder → FlutterTaggerWidgetBuilder
-
Widget builder for FlutterTagger's associated TextField.
Returned widget should be the TextField with the GlobalKey as its key.
final
- controller → FlutterTaggerController
-
Controller for FlutterTagger.
This object exposes callback registration bindings to enable clearing
FlutterTagger's tags, dismissing overlay and retrieving formatted text.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onFormattedTextChanged → void Function(String)?
-
Callback to dispatch updated formatted text.
final
- onSearch → FlutterTaggerSearchCallback
-
Called with the search query and character that triggered the search
whenever FlutterTagger enters the search context.
final
- overlay → Widget
-
Widget shown in the overlay when search context is active.
final
- overlayHeight → double
-
The overlay's height.
final
- overlayPosition → OverlayPosition
-
Position of overlay relative to the TextField.
final
- padding → EdgeInsetsGeometry
-
Padding applied to overlay.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchRegex → RegExp?
-
Regex to match allowed search characters.
Non-conforming characters terminate the search context.
final
- tagTextFormatter → TagTextFormatter?
-
Formats and replaces tags for raw text retrieval.
By default, tags are replaced in this format:
final
-
triggerCharacterAndStyles
→ Map<
String, TextStyle> -
Lookup table of trigger characters and their associated TextStyle styles.
These styles are applied to the tags/mentions resulting from their associated
trigger character.
final
- triggerCharactersRegex → RegExp?
-
Regex to match allowed trigger characters.
Trigger characters activate the search context.
If null, a Regex pattern is constructed from the
trigger characters in triggerCharacterAndStyles.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< FlutterTagger> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited