JeffG05/emoji_picker

Recent emojis did't work

Opened this issue · 2 comments

its always showing "NO Recent", version using 0.1.0

Hello, I finded a temporary solution for this issue.

like above:
import 'package:emoji_picker/emoji_picker.dart' as emoji;

Create a GlobalKey:
final key = new GlobalKey<State<emoji.EmojiPicker>>();

Final code like above:

Widget buildSticker() {
    picker = emoji.EmojiPicker(
      key: key,
      bgColor: ColorsConst.bg,
      indicatorColor: ColorsConst.primary,
      selectedCategory: emoji.Category.RECENT,
      rows: 3,
      columns: 7,
      buttonMode: emoji.ButtonMode.MATERIAL,
      recommendKeywords: [],
      numRecommended: 10,
      onEmojiSelected: (emoji, category) {
        (key.currentState as dynamic).addRecentEmoji(emoji);
        //createState().addRecentEmoji(emoji);
      },
    );
    return picker;
  } 

Looking at the code the issue seems to be that recent emoji are only added within the recommended category https://github.com/JeffG05/emoji_picker/blob/master/lib/emoji_picker.dart#L576-L578