diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d83213..efc8a61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,3 +28,7 @@ Add scrollbar to category list, for more intuitive scrolling on desktop. ## 1.1.1 Wait for end of frame before highlighting categories, fixing an issue where category highlights could be one scroll outdated. + +## 1.1.2 + +Make search case-insensitive. diff --git a/README.md b/README.md index 35031f3..4176040 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ -A generic but configurable emoji picker for Flutter. Defaults to including only unicode emojis, sourced from gemoji, but can be configured to show custom emotes. +A configurable emoji picker for Flutter. It defaults to Unicode emojis sourced from [gemoji](https://github.com/wooorm/gemoji), but can be extended with custom emojis rendered as arbitrary Flutter widgets. ## Features -- Up-to-date emojis, sourced from gemoji -- The ability to prepend or append custom categories with custom emoji -- Support for free text selection -- High performance due to using slivers plus a custom listener -- Sleek M3 design: +- Up-to-date Unicode emojis, sourced from gemoji +- Custom emoji categories that can be prepended or appended to the default categories +- Custom emojis can be rendered as arbitrary Flutter widgets, supporting images, GIFs, stickers, and more +- Recent emojis can be easily implemented using `prependCategories` +- Optional free-text selection +- Designed for high performance using slivers and a custom scroll listener +- Sleek Material 3 design -![A screenshot of the emoji picker, showing a searchbar, category selection, and two categories of emojis](https://git.federated.nexus/Henry-Hiles/material_emoji_picker/raw/branch/main/assets/screenshots/main.png) +![A screenshot of the emoji picker, showing a search bar, category selection, and two categories of emojis](https://git.federated.nexus/Henry-Hiles/material_emoji_picker/raw/branch/main/assets/screenshots/main.png) ## Getting started @@ -16,9 +18,9 @@ Add the package to your project with `flutter pub get`. ## Usage -`EmojiPicker` is very generic and can be used in multiple context, like a bottom sheet, dialog, or even as just a widget on your page. +`EmojiPicker` is can be used in a variety of contexts, including bottom sheets, dialogs, or directly in your widget tree. -An example, using `EmojiPicker` as a bottom sheet: +For example, using it as a bottom sheet: ```dart showModalBottomSheet( @@ -33,6 +35,20 @@ showModalBottomSheet( ); ``` +### Custom emojis + +Custom categories can contain `Emoji` objects whose `widget` can be any Flutter widget. This makes it possible to use image-based emojis, GIFs, stickers, or other custom visual representations: + +```dart +Emoji( + widget: Image.network('https://example.com/blob.webp'), + value: ':blob:', + aliases: ['blob'], + description: 'Blob', + tags: ['custom', 'blob'], +) +``` + ### Accepted Parameters - `IList prependCategories`: Categories to prepend to the default emoji list diff --git a/lib/src/widgets/emoji_picker.dart b/lib/src/widgets/emoji_picker.dart index 5695a05..69e6beb 100644 --- a/lib/src/widgets/emoji_picker.dart +++ b/lib/src/widgets/emoji_picker.dart @@ -166,19 +166,20 @@ class EmojiPicker extends HookConsumerWidget { (index, category) => Builder( builder: (context) { final headerKey = headerKeys[index]; - final emojis = search.value.isEmpty + final searchTerm = search.value.toLowerCase(); + final emojis = searchTerm.isEmpty ? category.emojis : category.emojis .where( (emoji) => emoji.aliases.join().contains( - search.value, + searchTerm, ) || emoji.description.contains( - search.value, + searchTerm, ) || emoji.tags.join().contains( - search.value, + searchTerm, ), ) .toIList(); diff --git a/pubspec.yaml b/pubspec.yaml index 10845a2..b29bd70 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: material_emoji_picker description: A generic but configurable emoji picker for Flutter -version: 1.1.1+2 +version: 1.1.2 repository: https://git.federated.nexus/Henry-Hiles/material_emoji_picker issue_tracker: https://git.federated.nexus/Henry-Hiles/material_emoji_picker/issues