-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
556 changed files
with
29,651 additions
and
135,846 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ name: stream_flutter_workflow | |
|
||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' | ||
flutter_version: "3.0.0" | ||
melos_version: "2.1.0" | ||
flutter_version: "3.3.3" | ||
melos_version: "2.7.1" | ||
|
||
on: | ||
pull_request: | ||
|
@@ -77,7 +77,7 @@ jobs: | |
test: | ||
runs-on: macos-latest | ||
if: github.event.pull_request.draft == false | ||
timeout-minutes: 20 | ||
timeout-minutes: 30 | ||
steps: | ||
- name: "Git Checkout" | ||
uses: actions/checkout@v2 | ||
|
@@ -111,22 +111,27 @@ jobs: | |
uses: VeryGoodOpenSource/[email protected] | ||
with: | ||
path: packages/stream_chat/coverage/lcov.info | ||
min_coverage: 80 | ||
min_coverage: 79 | ||
- name: "Stream Chat Persistence Coverage Check" | ||
uses: VeryGoodOpenSource/[email protected] | ||
with: | ||
path: packages/stream_chat_localizations/coverage/lcov.info | ||
min_coverage: 88 | ||
- name: "Stream Chat Persistence Coverage Check" | ||
uses: VeryGoodOpenSource/[email protected] | ||
with: | ||
path: packages/stream_chat_persistence/coverage/lcov.info | ||
min_coverage: 95 | ||
min_coverage: 97 | ||
- name: "Stream Chat Flutter Core Coverage Check" | ||
uses: VeryGoodOpenSource/[email protected] | ||
with: | ||
path: packages/stream_chat_flutter_core/coverage/lcov.info | ||
min_coverage: 90 | ||
min_coverage: 30 | ||
- name: "Stream Chat Flutter Coverage Check" | ||
uses: VeryGoodOpenSource/[email protected] | ||
with: | ||
path: packages/stream_chat_flutter/coverage/lcov.info | ||
min_coverage: 67 | ||
min_coverage: 44 | ||
|
||
draft-build: | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
docusaurus/docs/Flutter/guides/autocomplete_triggers.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
--- | ||
id: autocomplete_triggers | ||
title: Adding Custom Autocomplete Triggers | ||
--- | ||
|
||
Adding Custom Autocomplete Triggers | ||
|
||
### Introduction | ||
|
||
The [StreamMessageInput](../stream_chat_flutter/message_input.mdx) widget provides a way to add custom autocomplete triggers using the `StreamMessageInput.customAutocompleteTriggers` property. | ||
|
||
By default we provide autocomplete triggers for mentions and commands, but it's very easy to add your custom ones. | ||
|
||
### Add Emoji Autocomplete Trigger | ||
|
||
To add a custom emoji autocomplete trigger, you must first create an `AutoCompleteOptions` widget. | ||
This widget will be used to show the autocomplete options. | ||
|
||
For this example we're using two external dependencies: | ||
|
||
- [emojis](https://pub.dev/packages/emojis) | ||
- [substring_highlight](https://pub.dev/packages/substring_highlight) | ||
|
||
```dart | ||
import 'package:emojis/emoji.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:stream_chat_flutter/stream_chat_flutter.dart'; | ||
import 'package:substring_highlight/substring_highlight.dart'; | ||
/// Overlay for displaying emoji that can be used | ||
class StreamEmojiAutocompleteOptions extends StatelessWidget { | ||
/// Constructor for creating a [StreamEmojiAutocompleteOptions] | ||
const StreamEmojiAutocompleteOptions({ | ||
super.key, | ||
required this.query, | ||
this.onEmojiSelected, | ||
}); | ||
/// Query for searching emoji. | ||
final String query; | ||
/// Callback called when an emoji is selected. | ||
final ValueSetter<Emoji>? onEmojiSelected; | ||
@override | ||
Widget build(BuildContext context) { | ||
final emojis = Emoji.all().where((it) { | ||
final normalizedQuery = query.toUpperCase(); | ||
final normalizedShortName = it.shortName.toUpperCase(); | ||
return normalizedShortName.contains(normalizedQuery); | ||
}); | ||
if (emojis.isEmpty) return const SizedBox.shrink(); | ||
return StreamAutocompleteOptions<Emoji>( | ||
options: emojis, | ||
optionBuilder: (context, emoji) { | ||
final themeData = Theme.of(context); | ||
return ListTile( | ||
dense: true, | ||
horizontalTitleGap: 0, | ||
leading: Text( | ||
emoji.char, | ||
style: themeData.textTheme.headline6!.copyWith( | ||
fontSize: 24, | ||
), | ||
), | ||
title: SubstringHighlight( | ||
text: emoji.shortName, | ||
term: query, | ||
textStyleHighlight: themeData.textTheme.headline6!.copyWith( | ||
color: Colors.yellow, | ||
fontSize: 14.5, | ||
fontWeight: FontWeight.bold, | ||
), | ||
textStyle: themeData.textTheme.headline6!.copyWith( | ||
fontSize: 14.5, | ||
), | ||
), | ||
onTap: onEmojiSelected == null ? null : () => onEmojiSelected!(emoji), | ||
); | ||
}, | ||
); | ||
} | ||
} | ||
``` | ||
|
||
Now it's time to use the `StreamEmojiAutocompleteOptions` widget. | ||
|
||
```dart | ||
StreamMessageInput( | ||
customAutocompleteTriggers: [ | ||
StreamAutocompleteTrigger( | ||
trigger: ':', | ||
minimumRequiredCharacters: 2, | ||
optionsViewBuilder: ( | ||
context, | ||
autocompleteQuery, | ||
messageEditingController, | ||
) { | ||
final query = autocompleteQuery.query; | ||
return StreamEmojiAutocompleteOptions( | ||
query: query, | ||
onEmojiSelected: (emoji) { | ||
// accepting the autocomplete option. | ||
StreamAutocomplete.of(context).acceptAutocompleteOption( | ||
emoji.char, | ||
keepTrigger: false, | ||
); | ||
}, | ||
); | ||
}, | ||
), | ||
], | ||
), | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.