flutter_taggable
1.1.2, released 2 years ago by wesselvandam.com
Lightweight TextEditingController extension for user mentions, hashtags, and entity tagging.
What it does
Extends the standard TextField with a TagTextEditingController to let users mention users or insert hashtags. It parses tags into database-friendly formats and converts them into frontend display representations or InlineSpans.
AI-written summary of version 1.1.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need user mentions or hashtags in a text input field.
- You want database-friendly tag representation (e.g., storing IDs instead of display names).
Skip it when
- You are not using standard TextField widgets.
- You require complex WYSIWYG rich text editor features beyond inline mentions.
Strengths
- Integrates seamlessly with the standard TextField widget.
- Handles backspacing over a tag by deleting the entire tag automatically.
- Supports customizable tag styles and multiple tagging prefixes.
Weaknesses
- Cursor position and selection ranges around tags can have imperfect behavior.
- Requires manual implementation of overlay/search UI through callbacks.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
class TaggableExample extends StatefulWidget {
@override
_TaggableExampleState createState() => _TaggableExampleState();
}
class _TaggableExampleState extends State<TaggableExample> {
late TagTextEditingController _controller;
@override
void initState() {
super.initState();
_controller = TagTextEditingController<Taggable>(
searchTaggables: searchTaggables,
buildTaggables: buildTaggables,
toFrontendConverter: (taggable) => taggable.name,
toBackendConverter: (taggable) => taggable.id,
tagStyles: {
'@': const TextStyle(color: Colors.blue),
'#': const TextStyle(color: Colors.green),
},
);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return TextField(controller: _controller);
}
}Alternatives
Packages that do the same job and could replace flutter_taggable.
- fluttertagger
Extend Flutter TextFields to support tagging capabilities like user mentions and hashtags.
57Compare - searchfield
An autocomplete search widget with customizable suggestions, validation, and keyboard navigation.
79Compare - flutter_social_textfield
TextEditingController and RichText builder for hashtag, url, mention and emoji detection.
48Compare - mention_tag_text_field
Adds mention and tagging capabilities to TextField or TextFormField widgets in Flutter.
48Compare