diff --git a/CHANGELOG.md b/CHANGELOG.md index d8d0433..293fac1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 1.0.5 * Fix appearance of emoji when device font size is not default ๐Ÿ–ฅ +* Add Backspace-Button & OnBackspacePressed-Callback for easier deletion of added Emoji's ## 1.0.4 diff --git a/README.md b/README.md index b71e971..c64c612 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,10 @@ EmojiPicker( onEmojiSelected: (category, emoji) { // Do something when emoji is tapped }, + onBackspacePressed: () { + // Backspace-Button tapped logic + // Remove this line to also remove the button in the UI + }, config: Config( columns: 7, emojiSizeMax: 32.0, @@ -66,6 +70,7 @@ See the [demo](https://github.com/Fintasys/emoji_picker_flutter/blob/master/exam | iconColor | The color of the category icons | Colors.grey | | iconColorSelected | The color of the category icon when selected | Colors.blue | | progressIndicatorColor | The color of the loading indicator during initalization | Colors.blue | +| backspaceColor | The color of the backspace icon button | Colors.blue | | showRecentsTab | Show extra tab with recently used emoji | true | | recentsLimit | Limit of recently used emoji that will be saved | 28 | | noRecentsText | The text to be displayed if no recent emojis to display | "No Recents" | @@ -73,6 +78,11 @@ See the [demo](https://github.com/Fintasys/emoji_picker_flutter/blob/master/exam | categoryIcons | Determines the icon to display for each Category. You can change icons by setting them in the constructor. | CategoryIcons() | | buttonMode | Choose between Material and Cupertino button style | ButtonMode.MATERIAL | +## Backspace-Button +You can add an Backspace-Button to the end category list by adding the callback method `onBackspacePressed: () { }` to the EmojiPicker-Widget. This will make it easier for your user to remove an added Emoji without showing the keyboard. Check out the example for more details about usage. + + + ## Custom view The appearance is completely customizable by setting `customWidget` property. If properties in Config are not enough you can inherit from `EmojiPickerBuilder` (recommended but not necessary) to make further adjustments. ``` diff --git a/example/lib/main.dart b/example/lib/main.dart index 483a528..a33d20f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -15,6 +15,20 @@ class _MyAppState extends State { final TextEditingController _controller = TextEditingController(); bool emojiShowing = false; + _onEmojiSelected(Emoji emoji) { + _controller + ..text += emoji.emoji + ..selection = TextSelection.fromPosition( + TextPosition(offset: _controller.text.length)); + } + + _onBackspacePressed() { + _controller + ..text = _controller.text.characters.skipLast(1).toString() + ..selection = TextSelection.fromPosition( + TextPosition(offset: _controller.text.length)); + } + @override Widget build(BuildContext context) { return MaterialApp( @@ -86,11 +100,9 @@ class _MyAppState extends State { height: 250, child: EmojiPicker( onEmojiSelected: (Category category, Emoji emoji) { - _controller - ..text += emoji.emoji - ..selection = TextSelection.fromPosition( - TextPosition(offset: _controller.text.length)); + _onEmojiSelected(emoji); }, + onBackspacePressed: _onBackspacePressed, config: const Config( columns: 7, emojiSizeMax: 32.0, @@ -102,6 +114,7 @@ class _MyAppState extends State { iconColor: Colors.grey, iconColorSelected: Colors.blue, progressIndicatorColor: Colors.blue, + backspaceColor: Colors.blue, showRecentsTab: true, recentsLimit: 28, noRecentsText: 'No Recents', diff --git a/example/pubspec.lock b/example/pubspec.lock index 4054f8e..5f445d4 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -2,7 +2,7 @@ # See https://dart.dev/tools/pub/glossary#lockfile packages: characters: - dependency: transitive + dependency: "direct main" description: name: characters url: "https://pub.dartlang.org" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 0229f53..6188a04 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -8,6 +8,7 @@ environment: dependencies: flutter: sdk: flutter + characters: ^1.1.0 emoji_picker_flutter: path: ../ diff --git a/lib/src/config.dart b/lib/src/config.dart index b40b43d..0ad5cee 100644 --- a/lib/src/config.dart +++ b/lib/src/config.dart @@ -18,6 +18,7 @@ class Config { this.iconColor = Colors.grey, this.iconColorSelected = Colors.blue, this.progressIndicatorColor = Colors.blue, + this.backspaceColor = Colors.blue, this.showRecentsTab = true, this.recentsLimit = 28, this.noRecentsText = 'No Recents', @@ -58,6 +59,9 @@ class Config { /// The color of the loading indicator during initalization final Color progressIndicatorColor; + /// The color of the backspace icon button + final Color backspaceColor; + /// Show extra tab with recently used emoji final bool showRecentsTab; diff --git a/lib/src/default_emoji_picker_view.dart b/lib/src/default_emoji_picker_view.dart index 5a56fc1..5144bdf 100644 --- a/lib/src/default_emoji_picker_view.dart +++ b/lib/src/default_emoji_picker_view.dart @@ -36,6 +36,24 @@ class _DefaultEmojiPickerViewState extends State super.initState(); } + Widget _buildBackspaceButton() { + if (widget.state.onBackspacePressed != null) { + return Material( + type: MaterialType.transparency, + child: IconButton( + padding: const EdgeInsets.only(bottom: 2), + icon: Icon( + Icons.backspace, + color: widget.config.backspaceColor, + ), + onPressed: () { + widget.state.onBackspacePressed!(); + }), + ); + } + return Container(); + } + @override Widget build(BuildContext context) { return LayoutBuilder( @@ -46,21 +64,28 @@ class _DefaultEmojiPickerViewState extends State color: widget.config.bgColor, child: Column( children: [ - TabBar( - labelColor: widget.config.iconColorSelected, - indicatorColor: widget.config.indicatorColor, - unselectedLabelColor: widget.config.iconColor, - controller: _tabController, - labelPadding: EdgeInsets.zero, - onTap: (index) { - _pageController!.jumpToPage(index); - }, - tabs: widget.state.categoryEmoji - .asMap() - .entries - .map( - (item) => _buildCategory(item.key, item.value.category)) - .toList(), + Row( + children: [ + Expanded( + child: TabBar( + labelColor: widget.config.iconColorSelected, + indicatorColor: widget.config.indicatorColor, + unselectedLabelColor: widget.config.iconColor, + controller: _tabController, + labelPadding: EdgeInsets.zero, + onTap: (index) { + _pageController!.jumpToPage(index); + }, + tabs: widget.state.categoryEmoji + .asMap() + .entries + .map((item) => + _buildCategory(item.key, item.value.category)) + .toList(), + ), + ), + _buildBackspaceButton(), + ], ), Flexible( child: PageView.builder( diff --git a/lib/src/emoji_lists.dart b/lib/src/emoji_lists.dart index 8d85ec5..8bd2dbf 100644 --- a/lib/src/emoji_lists.dart +++ b/lib/src/emoji_lists.dart @@ -429,8 +429,8 @@ final Map smileys = Map.fromIterables([ '๐Ÿ˜•', '๐Ÿ˜Ÿ', '๐Ÿ™', - 'โ˜น\ufe0f', - '\ud83d\udea3', + 'โ˜น๏ธ', + '๐Ÿšฃ', '๐Ÿ˜ฏ', '๐Ÿ˜ฒ', '๐Ÿ˜ณ', @@ -526,82 +526,82 @@ final Map smileys = Map.fromIterables([ '๐Ÿง‘', '๐Ÿ‘จ', '๐Ÿง”', - '๐Ÿ‘ฑ\u200dโ™‚๏ธ', - '๐Ÿ‘จ\u200d๐Ÿฆฐ', - '๐Ÿ‘จ\u200d๐Ÿฆฑ', - '๐Ÿ‘จ\u200d๐Ÿฆณ', - '๐Ÿ‘จ\u200d๐Ÿฆฒ', + '๐Ÿ‘ฑ', + '๐Ÿ‘จโ€๐Ÿฆฐ', + '๐Ÿ‘จโ€๐Ÿฆฑ', + '๐Ÿ‘จโ€๐Ÿฆณ', + '๐Ÿ‘จโ€๐Ÿฆฒ', '๐Ÿ‘ฉ', - '๐Ÿ‘ฑ\u200dโ™€๏ธ', - '๐Ÿ‘ฉ\u200d๐Ÿฆฐ', - '๐Ÿ‘ฉ\u200d๐Ÿฆฑ', - '๐Ÿ‘ฉ\u200d๐Ÿฆณ', - '๐Ÿ‘ฉ\u200d๐Ÿฆฒ', + '๐Ÿ‘ฑ', + '๐Ÿ‘ฉโ€๐Ÿฆฐ', + '๐Ÿ‘ฉโ€๐Ÿฆฑ', + '๐Ÿ‘ฉโ€๐Ÿฆณ', + '๐Ÿ‘ฉโ€๐Ÿฆฒ', '๐Ÿง“', '๐Ÿ‘ด', '๐Ÿ‘ต', - '๐Ÿ™\u200dโ™‚๏ธ', - '๐Ÿ™\u200dโ™€๏ธ', - '๐Ÿ™Ž\u200dโ™‚๏ธ', - '๐Ÿ™Ž\u200dโ™€๏ธ', - '๐Ÿ™…\u200dโ™‚๏ธ', - '๐Ÿ™…\u200dโ™€๏ธ', - '๐Ÿ™†\u200dโ™‚๏ธ', - '๐Ÿ™†\u200dโ™€๏ธ', - '๐Ÿ’\u200dโ™‚๏ธ', - '๐Ÿ’\u200dโ™€๏ธ', - '๐Ÿ™‹\u200dโ™‚๏ธ', - '๐Ÿ™‹\u200dโ™€๏ธ', - '๐Ÿ™‡\u200dโ™‚๏ธ', - '๐Ÿ™‡\u200dโ™€๏ธ', - '๐Ÿคฆ\u200dโ™‚๏ธ', - '๐Ÿคฆ\u200dโ™€๏ธ', - '๐Ÿคท\u200dโ™‚๏ธ', - '๐Ÿคท\u200dโ™€๏ธ', - '๐Ÿ‘จ\u200dโš•๏ธ', - '๐Ÿ‘ฉ\u200dโš•๏ธ', - '๐Ÿ‘จ\u200d๐ŸŽ“', - '๐Ÿ‘ฉ\u200d๐ŸŽ“', - '๐Ÿ‘จ\u200d๐Ÿซ', - '๐Ÿ‘ฉ\u200d๐Ÿซ', - '๐Ÿ‘จ\u200dโš–๏ธ', - '๐Ÿ‘ฉ\u200dโš–๏ธ', - '๐Ÿ‘จ\u200d๐ŸŒพ', - '๐Ÿ‘ฉ\u200d๐ŸŒพ', - '๐Ÿ‘จ\u200d๐Ÿณ', - '๐Ÿ‘ฉ\u200d๐Ÿณ', - '๐Ÿ‘จ\u200d๐Ÿ”ง', - '๐Ÿ‘ฉ\u200d๐Ÿ”ง', - '๐Ÿ‘จ\u200d๐Ÿญ', - '๐Ÿ‘ฉ\u200d๐Ÿญ', - '๐Ÿ‘จ\u200d๐Ÿ’ผ', - '๐Ÿ‘ฉ\u200d๐Ÿ’ผ', - '๐Ÿ‘จ\u200d๐Ÿ”ฌ', - '๐Ÿ‘ฉ\u200d๐Ÿ”ฌ', - '๐Ÿ‘จ\u200d๐Ÿ’ป', - '๐Ÿ‘ฉ\u200d๐Ÿ’ป', - '๐Ÿ‘จ\u200d๐ŸŽค', - '๐Ÿ‘ฉ\u200d๐ŸŽค', - '๐Ÿ‘จ\u200d๐ŸŽจ', - '๐Ÿ‘ฉ\u200d๐ŸŽจ', - '๐Ÿ‘จ\u200dโœˆ๏ธ', - '๐Ÿ‘ฉ\u200dโœˆ๏ธ', - '๐Ÿ‘จ\u200d๐Ÿš€', - '๐Ÿ‘ฉ\u200d๐Ÿš€', - '๐Ÿ‘จ\u200d๐Ÿš’', - '๐Ÿ‘ฉ\u200d๐Ÿš’', - '๐Ÿ‘ฎ\u200dโ™‚๏ธ', - '๐Ÿ‘ฎ\u200dโ™€๏ธ', - '๐Ÿ•ต๏ธ\u200dโ™‚๏ธ', - '๐Ÿ•ต๏ธ\u200dโ™€๏ธ', - '๐Ÿ’‚\u200dโ™‚๏ธ', - '๐Ÿ’‚\u200dโ™€๏ธ', - '๐Ÿ‘ท\u200dโ™‚๏ธ', - '๐Ÿ‘ท\u200dโ™€๏ธ', + '๐Ÿ™', + '๐Ÿ™', + '๐Ÿ™Ž', + '๐Ÿ™Ž', + '๐Ÿ™…', + '๐Ÿ™…', + '๐Ÿ™†', + '๐Ÿ™†', + '๐Ÿ’', + '๐Ÿ’', + '๐Ÿ™‹', + '๐Ÿ™‹', + '๐Ÿ™‡', + '๐Ÿ™‡', + '๐Ÿคฆ', + '๐Ÿคฆ', + '๐Ÿคท', + '๐Ÿคท', + '๐Ÿ‘จโ€โš•๏ธ', + '๐Ÿ‘ฉโ€โš•๏ธ', + '๐Ÿ‘จโ€๐ŸŽ“', + '๐Ÿ‘ฉโ€๐ŸŽ“', + '๐Ÿ‘จโ€๐Ÿซ', + '๐Ÿ‘ฉโ€๐Ÿซ', + '๐Ÿ‘จโ€โš–๏ธ', + '๐Ÿ‘ฉโ€โš–๏ธ', + '๐Ÿ‘จโ€๐ŸŒพ', + '๐Ÿ‘ฉโ€๐ŸŒพ', + '๐Ÿ‘จโ€๐Ÿณ', + '๐Ÿ‘ฉโ€๐Ÿณ', + '๐Ÿ‘จโ€๐Ÿ”ง', + '๐Ÿ‘ฉโ€๐Ÿ”ง', + '๐Ÿ‘จโ€๐Ÿญ', + '๐Ÿ‘ฉโ€๐Ÿญ', + '๐Ÿ‘จโ€๐Ÿ’ผ', + '๐Ÿ‘ฉโ€๐Ÿ’ผ', + '๐Ÿ‘จโ€๐Ÿ”ฌ', + '๐Ÿ‘ฉโ€๐Ÿ”ฌ', + '๐Ÿ‘จโ€๐Ÿ’ป', + '๐Ÿ‘ฉโ€๐Ÿ’ป', + '๐Ÿ‘จโ€๐ŸŽค', + '๐Ÿ‘ฉโ€๐ŸŽค', + '๐Ÿ‘จโ€๐ŸŽจ', + '๐Ÿ‘ฉโ€๐ŸŽจ', + '๐Ÿ‘จโ€โœˆ๏ธ', + '๐Ÿ‘ฉโ€โœˆ๏ธ', + '๐Ÿ‘จโ€๐Ÿš€', + '๐Ÿ‘ฉโ€๐Ÿš€', + '๐Ÿ‘จโ€๐Ÿš’', + '๐Ÿ‘ฉโ€๐Ÿš’', + '๐Ÿ‘ฎ', + '๐Ÿ‘ฎ', + '๐Ÿ•ต๏ธ', + '๐Ÿ•ต๏ธ', + '๐Ÿ’‚', + '๐Ÿ’‚', + '๐Ÿ‘ท', + '๐Ÿ‘ท', '๐Ÿคด', '๐Ÿ‘ธ', - '๐Ÿ‘ณ\u200dโ™‚๏ธ', - '๐Ÿ‘ณ\u200dโ™€๏ธ', + '๐Ÿ‘ณ', + '๐Ÿ‘ณ', '๐Ÿ‘ฒ', '๐Ÿง•', '๐Ÿคต', @@ -611,75 +611,75 @@ final Map smileys = Map.fromIterables([ '๐Ÿ‘ผ', '๐ŸŽ…', '๐Ÿคถ', - '๐Ÿฆธ\u200dโ™‚๏ธ', - '๐Ÿฆธ\u200dโ™€๏ธ', - '๐Ÿฆน\u200dโ™‚๏ธ', - '๐Ÿฆน\u200dโ™€๏ธ', - '๐Ÿง™\u200dโ™‚๏ธ', - '๐Ÿง™\u200dโ™€๏ธ', - '๐Ÿงš\u200dโ™‚๏ธ', - '๐Ÿงš\u200dโ™€๏ธ', - '๐Ÿง›\u200dโ™‚๏ธ', - '๐Ÿง›\u200dโ™€๏ธ', - '๐Ÿงœ\u200dโ™‚๏ธ', - '๐Ÿงœ\u200dโ™€๏ธ', - '๐Ÿง\u200dโ™‚๏ธ', - '๐Ÿง\u200dโ™€๏ธ', - '๐Ÿงž\u200dโ™‚๏ธ', - '๐Ÿงž\u200dโ™€๏ธ', - '๐ŸงŸ\u200dโ™‚๏ธ', - '๐ŸงŸ\u200dโ™€๏ธ', - '๐Ÿ’†\u200dโ™‚๏ธ', - '๐Ÿ’†\u200dโ™€๏ธ', - '๐Ÿ’‡\u200dโ™‚๏ธ', - '๐Ÿ’‡\u200dโ™€๏ธ', - '๐Ÿšถ\u200dโ™‚๏ธ', - '๐Ÿšถ\u200dโ™€๏ธ', - '๐Ÿƒ\u200dโ™‚๏ธ', - '๐Ÿƒ\u200dโ™€๏ธ', + '๐Ÿฆธ', + '๐Ÿฆธ', + '๐Ÿฆน', + '๐Ÿฆน', + '๐Ÿง™', + '๐Ÿง™', + '๐Ÿงš', + '๐Ÿงš', + '๐Ÿง›', + '๐Ÿง›', + '๐Ÿงœ', + '๐Ÿงœ', + '๐Ÿง', + '๐Ÿง', + '๐Ÿงž', + '๐Ÿงž', + '๐ŸงŸ', + '๐ŸงŸ', + '๐Ÿ’†', + '๐Ÿ’†', + '๐Ÿ’‡', + '๐Ÿ’‡', + '๐Ÿšถ', + '๐Ÿšถ', + '๐Ÿƒ', + '๐Ÿƒ', '๐Ÿ’ƒ', '๐Ÿ•บ', '๐Ÿ•ด', - '๐Ÿ‘ฏ\u200dโ™‚๏ธ', - '๐Ÿ‘ฏ\u200dโ™€๏ธ', - '๐Ÿง–\u200dโ™‚๏ธ', - '๐Ÿง–\u200dโ™€๏ธ', + '๐Ÿ‘ฏ', + '๐Ÿ‘ฏ', + '๐Ÿง–', + '๐Ÿง–', '๐Ÿง˜', '๐Ÿ‘ญ', '๐Ÿ‘ซ', '๐Ÿ‘ฌ', '๐Ÿ’', - '๐Ÿ‘จ\u200dโค๏ธ\u200d๐Ÿ’‹\u200d๐Ÿ‘จ', - '๐Ÿ‘ฉ\u200dโค๏ธ\u200d๐Ÿ’‹\u200d๐Ÿ‘ฉ', + '๐Ÿ‘จโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿ‘จ', + '๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿ‘ฉ', '๐Ÿ’‘', - '๐Ÿ‘จ\u200dโค๏ธ\u200d๐Ÿ‘จ', - '๐Ÿ‘ฉ\u200dโค๏ธ\u200d๐Ÿ‘ฉ', + '๐Ÿ‘จโ€โค๏ธโ€๐Ÿ‘จ', + '๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ‘ฉ', '๐Ÿ‘ช', - '๐Ÿ‘จ\u200d๐Ÿ‘ฉ\u200d๐Ÿ‘ฆ', - '๐Ÿ‘จ\u200d๐Ÿ‘ฉ\u200d๐Ÿ‘ง', - '๐Ÿ‘จ\u200d๐Ÿ‘ฉ\u200d๐Ÿ‘ง\u200d๐Ÿ‘ฆ', - '๐Ÿ‘จ\u200d๐Ÿ‘ฉ\u200d๐Ÿ‘ฆ\u200d๐Ÿ‘ฆ', - '๐Ÿ‘จ\u200d๐Ÿ‘ฉ\u200d๐Ÿ‘ง\u200d๐Ÿ‘ง', - '๐Ÿ‘จ\u200d๐Ÿ‘จ\u200d๐Ÿ‘ฆ', - '๐Ÿ‘จ\u200d๐Ÿ‘จ\u200d๐Ÿ‘ง', - '๐Ÿ‘จ\u200d๐Ÿ‘จ\u200d๐Ÿ‘ง\u200d๐Ÿ‘ฆ', - '๐Ÿ‘จ\u200d๐Ÿ‘จ\u200d๐Ÿ‘ฆ\u200d๐Ÿ‘ฆ', - '๐Ÿ‘จ\u200d๐Ÿ‘จ\u200d๐Ÿ‘ง\u200d๐Ÿ‘ง', - '๐Ÿ‘ฉ\u200d๐Ÿ‘ฉ\u200d๐Ÿ‘ฆ', - '๐Ÿ‘ฉ\u200d๐Ÿ‘ฉ\u200d๐Ÿ‘ง', - '๐Ÿ‘ฉ\u200d๐Ÿ‘ฉ\u200d๐Ÿ‘ง\u200d๐Ÿ‘ฆ', - '๐Ÿ‘ฉ\u200d๐Ÿ‘ฉ\u200d๐Ÿ‘ฆ\u200d๐Ÿ‘ฆ', - '๐Ÿ‘ฉ\u200d๐Ÿ‘ฉ\u200d๐Ÿ‘ง\u200d๐Ÿ‘ง', - '๐Ÿ‘จ\u200d๐Ÿ‘ฆ', - '๐Ÿ‘จ\u200d๐Ÿ‘ฆ\u200d๐Ÿ‘ฆ', - '๐Ÿ‘จ\u200d๐Ÿ‘ง', - '๐Ÿ‘จ\u200d๐Ÿ‘ง\u200d๐Ÿ‘ฆ', - '๐Ÿ‘จ\u200d๐Ÿ‘ง\u200d๐Ÿ‘ง', - '๐Ÿ‘ฉ\u200d๐Ÿ‘ฆ', - '๐Ÿ‘ฉ\u200d๐Ÿ‘ฆ\u200d๐Ÿ‘ฆ', - '๐Ÿ‘ฉ\u200d๐Ÿ‘ง', - '๐Ÿ‘ฉ\u200d๐Ÿ‘ง\u200d๐Ÿ‘ฆ', - '๐Ÿ‘ฉ\u200d๐Ÿ‘ง\u200d๐Ÿ‘ง', + '๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆ', + '๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ง', + '๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ', + '๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ', + '๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง', + '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘ฆ', + '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘ง', + '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ', + '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ', + '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ง', + '๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆ', + '๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘ง', + '๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ', + '๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ', + '๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง', + '๐Ÿ‘จโ€๐Ÿ‘ฆ', + '๐Ÿ‘จโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ', + '๐Ÿ‘จโ€๐Ÿ‘ง', + '๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ', + '๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ง', + '๐Ÿ‘ฉโ€๐Ÿ‘ฆ', + '๐Ÿ‘ฉโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ', + '๐Ÿ‘ฉโ€๐Ÿ‘ง', + '๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ', + '๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง', '๐Ÿ—ฃ', '๐Ÿ‘ค', '๐Ÿ‘ฅ', @@ -1659,39 +1659,39 @@ final Map activities = Map.fromIterables([ 'Bow and Arrow' ], [ '๐Ÿ•ด', - '๐Ÿง—\u200dโ™‚๏ธ', - '๐Ÿง—\u200dโ™€๏ธ', + '๐Ÿง—', + '๐Ÿง—', '๐Ÿ‡', 'โ›ท', '๐Ÿ‚', - '๐ŸŒ๏ธ\u200dโ™‚๏ธ', - '๐ŸŒ๏ธ\u200dโ™€๏ธ', - '๐Ÿ„\u200dโ™‚๏ธ', - '๐Ÿ„\u200dโ™€๏ธ', - '๐Ÿšฃ\u200dโ™‚๏ธ', - '๐Ÿšฃ\u200dโ™€๏ธ', - '๐ŸŠ\u200dโ™‚๏ธ', - '๐ŸŠ\u200dโ™€๏ธ', - 'โ›น๏ธ\u200dโ™‚๏ธ', - 'โ›น๏ธ\u200dโ™€๏ธ', - '๐Ÿ‹๏ธ\u200dโ™‚๏ธ', - '๐Ÿ‹๏ธ\u200dโ™€๏ธ', - '๐Ÿšด\u200dโ™‚๏ธ', - '๐Ÿšด\u200dโ™€๏ธ', - '๐Ÿšต\u200dโ™‚๏ธ', - '๐Ÿšต\u200dโ™€๏ธ', - '๐Ÿคธ\u200dโ™‚๏ธ', - '๐Ÿคธ\u200dโ™€๏ธ', - '๐Ÿคผ\u200dโ™‚๏ธ', - '๐Ÿคผ\u200dโ™€๏ธ', - '๐Ÿคฝ\u200dโ™‚๏ธ', - '๐Ÿคฝ\u200dโ™€๏ธ', - '๐Ÿคพ\u200dโ™‚๏ธ', - '๐Ÿคพ\u200dโ™€๏ธ', - '๐Ÿคน\u200dโ™‚๏ธ', - '๐Ÿคน\u200dโ™€๏ธ', - '๐Ÿง˜\u200dโ™‚๏ธ', - '๐Ÿง˜\u200dโ™€๏ธ', + '๐ŸŒ๏ธ', + '๐ŸŒ๏ธ', + '๐Ÿ„', + '๐Ÿ„', + '๐Ÿšฃ', + '๐Ÿšฃ', + '๐ŸŠ', + '๐ŸŠ', + 'โ›น๏ธ', + 'โ›น๏ธ', + '๐Ÿ‹๏ธ', + '๐Ÿ‹๏ธ', + '๐Ÿšด', + '๐Ÿšด', + '๐Ÿšต', + '๐Ÿšต', + '๐Ÿคธ', + '๐Ÿคธ', + '๐Ÿคผ', + '๐Ÿคผ', + '๐Ÿคฝ', + '๐Ÿคฝ', + '๐Ÿคพ', + '๐Ÿคพ', + '๐Ÿคน', + '๐Ÿคน', + '๐Ÿง˜๐Ÿปโ€โ™‚๏ธ', + '๐Ÿง˜๐Ÿปโ€โ™€๏ธ', '๐ŸŽช', '๐Ÿ›น', '๐ŸŽ—', @@ -2435,7 +2435,7 @@ final Map symbols = Map.fromIterables([ '๐Ÿ’ฏ', '๐Ÿ’ข', '๐Ÿ’ฌ', - '๐Ÿ‘๏ธ\u200d๐Ÿ—จ๏ธ', + '๐Ÿ‘๏ธโ€๐Ÿ—จ๏ธ', '๐Ÿ—ฏ', '๐Ÿ’ญ', '๐Ÿ’ค', @@ -2949,8 +2949,8 @@ final Map flags = Map.fromIterables([ '๐ŸŽŒ', '๐Ÿด', '๐Ÿณ', - '๐Ÿณ๏ธ\u200d๐ŸŒˆ', - '๐Ÿด\u200dโ˜ ๏ธ', + '๐Ÿณ๏ธโ€๐ŸŒˆ', + '๐Ÿดโ€โ˜ ๏ธ', '๐Ÿ‡ฆ๐Ÿ‡จ', '๐Ÿ‡ฆ๐Ÿ‡ฉ', '๐Ÿ‡ฆ๐Ÿ‡ช', diff --git a/lib/src/emoji_picker.dart b/lib/src/emoji_picker.dart index 2e0d550..ec37aed 100644 --- a/lib/src/emoji_picker.dart +++ b/lib/src/emoji_picker.dart @@ -42,7 +42,7 @@ enum Category { SYMBOLS, /// Flag emojis - FLAGS + FLAGS, } /// Enum to alter the keyboard button style @@ -60,6 +60,9 @@ enum ButtonMode { /// as the [Category] from which it originated typedef void OnEmojiSelected(Category category, Emoji emoji); +/// Callback function for backspace button +typedef void OnBackspacePressed(); + /// Callback function for custom view typedef EmojiViewBuilder = Widget Function(Config config, EmojiViewState state); @@ -75,6 +78,7 @@ class EmojiPicker extends StatefulWidget { EmojiPicker({ Key? key, required this.onEmojiSelected, + this.onBackspacePressed, this.config = const Config(), this.customWidget, }) : super(key: key); @@ -85,6 +89,9 @@ class EmojiPicker extends StatefulWidget { /// The function called when the emoji is selected final OnEmojiSelected onEmojiSelected; + /// The function called when backspace button is pressed + final OnBackspacePressed? onBackspacePressed; + /// Config for customizations final Config config; @@ -119,6 +126,7 @@ class _EmojiPickerState extends State { var state = EmojiViewState( categoryEmoji, _getOnEmojiListener(), + widget.onBackspacePressed, ); // Build diff --git a/lib/src/emoji_view_state.dart b/lib/src/emoji_view_state.dart index 4a0cbd3..a98e2ba 100644 --- a/lib/src/emoji_view_state.dart +++ b/lib/src/emoji_view_state.dart @@ -7,6 +7,7 @@ class EmojiViewState { EmojiViewState( this.categoryEmoji, this.onEmojiSelected, + this.onBackspacePressed, ); /// List of all category including their emoji @@ -14,4 +15,7 @@ class EmojiViewState { /// Callback when pressed on emoji final OnEmojiSelected onEmojiSelected; + + /// Callback when pressed on backspace + final OnBackspacePressed? onBackspacePressed; }