Fintasys / emoji_picker_flutter

A Flutter package that provides an Emoji picker widget with 1500+ emojis in 8 categories.
MIT License
155 stars 114 forks source link

Emoji not sent as part of message #59

Closed AnubhavChaubey1 closed 2 years ago

AnubhavChaubey1 commented 2 years ago

Screenshot_1646361522

Hello team, I'm facing a issue with your package. I am creating a message application where I use your package for sharing emojis. The issue that I'm facing is that, whenever I try to share only emoji as a message, I've to add a space as a suffix to make it shareable. Unless, I add a space, the message is not shared.

Example below is the code sample that I'm using:

Widget buildSticker() { return Offstage( offstage: !emojiShowing, child: SizedBox( height: 250, child: EmojiPicker( onEmojiSelected: (Category category, Emoji emoji) { _onEmojiSelected(emoji); }, onBackspacePressed: _onBackspacePressed, config: Config( columns: 7, // Issue: https://github.com/flutter/flutter/issues/28894 emojiSizeMax: 32 * (Platform.isIOS ? 1.0 : 0.7), verticalSpacing: 0, horizontalSpacing: 0, initCategory: Category.RECENT, bgColor: const Color(0xFFF2F2F2), indicatorColor: Colors.blue, iconColor: Colors.grey, iconColorSelected: Colors.blue, enableSkinTones: true, progressIndicatorColor: Colors.blue, backspaceColor: Colors.blue, showRecentsTab: true, recentsLimit: 28, noRecentsText: 'No Recents', noRecentsStyle: TextStyle( fontSize: 20, color: Colors.black26, fontFamily: ChatTheme.appFont, ), tabIndicatorAnimDuration: kTabScrollDuration, categoryIcons: const CategoryIcons(), buttonMode: ButtonMode.MATERIAL)), ), ); }

_onEmojiSelected(Emoji emoji) { _textController ..text += emoji.emoji ..selection = TextSelection.fromPosition( TextPosition(offset: _textController.text.length)); } Screenshot_1646361906 Screenshot_1646361909

Fintasys commented 2 years ago

@AnubhavChaubey1 Hey, sorry to get back to you that late. Could you solve the issue meanwhile in your App? I've tried to reproduce the issue in one of my apps with similar use case but it works just fine and code is similar like in the example of this library 🤔

AnubhavChaubey1 commented 2 years ago

Solved by a small hack of setting the active state of the textcontroller. Thank you

sridhar562345 commented 2 years ago

active state

@AnubhavChaubey1 can you elaborate the answer?