| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A highly customizable Flutter widget for detecting and handling interactive triggers like mentions, hashtags, and links within a text field.
Most Flutter mentions packages use simple string offset calculations, which often break during complex edits or IME (Input Method Editor) changes. flutter_trigger_input uses a modern Delta Architecture (Segment-based state management):
Define your triggers and their respective styles.
final _controller = TriggerInputController<SuggestionInfo>(
triggers: [
Mention(
trigger: '@',
style: const TextStyle(color: Colors.blue, fontWeight: FontWeight.bold),
),
Mention(
trigger: '#',
style: const TextStyle(color: Colors.pink),
),
],
);TriggerInputField<SuggestionInfo>(
controller: _controller,
allowSpace: true,
onMentionSearchChanged: (trigger, keyword) {
// Fetch and update suggestions in your state
final results = mySearchLogic(trigger, keyword);
_controller.state.suggestionInfos.value = results;
},
)Access the content in a structured JSON format (Delta) for your API.
String jsonMarkup = _controller.tfController.markupText;
// Output: [{"insert": "Hi "}, {"insert": "@John", "attributes": {"mention": {"id": "1"}}}]Feel free to open a Github issue for suggestions or bug reports.
| Back | FazBrowse Home | New Git URL |