multi_trigger_autocomplete
1.0.0, released 3 years ago by xdsahil.dev
Widget that adds trigger‑based autocomplete to text fields
What it does
MultiTriggerAutocomplete provides a text field with support for multiple autocomplete triggers such as @, #, and : . It shows a portal‑based options view that can be customized per trigger.
AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Implementing mention, hashtag or emoji autocompletion in chat or comment UIs
- Adding custom trigger‑based suggestions to a single text field
- Need a lightweight, declarative solution without code generation
Skip it when
- Using a non‑Flutter platform that cannot host a Portal
- When you need a global state‑management solution for autocomplete data
Strengths
- Supports multiple triggers in one widget
- Built on flutter_portal for flexible overlay placement
- Easy to integrate with existing TextField or TextFormField
- No code generation required
Weaknesses
- Requires flutter_portal dependency
- Only works with text fields, not rich text editors
- Limited to single‑line or multiline text with selection handling
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Add Portal at the top of the widget tree and include multi_trigger_autocomplete in pubspec
```dart
import 'package:multi_trigger_autocomplete/multi_trigger_autocomplete.dart';
Portal(
child: MaterialApp(
home: Scaffold(
body: MultiTriggerAutocomplete(
autocompleteTriggers: [
AutocompleteTrigger(
trigger: '@',
optionsViewBuilder: (ctx, query, ctrl) => MentionAutocompleteOptions(
query: query.query,
onMentionUserTap: (user) => MultiTriggerAutocomplete.of(ctx).acceptAutocompleteOption(user.id),
),
),
],
fieldViewBuilder: (ctx, ctrl, focus) => TextField(controller: ctrl, focusNode: focus),
),
),
),
);
```Alternatives
Packages that do the same job and could replace multi_trigger_autocomplete.
- text_scroll
A Flutter widget that auto‑scrolls overflowing text like a marquee.
89Compare - simple_search_dropdown
Searchable single and multi-select dropdowns with accent‑insensitive search and CRUD support
66Compare - flutter_draggable_gridview
Adds drag and drop reordering functionality to existing GridView.builder widgets.
64Compare - shadow_widget
A widget that adds a shadow effect to any Flutter widget.
49Compare
Works with
Packages commonly used together with multi_trigger_autocomplete: ones it builds on, ones built on it, and its own family.