简体   繁体   English

带有表情符号 flutter 的 TextField 小部件

[英]TextField Widget with emoji flutter

How can I open keyboard type == emoji .如何打开键盘type == emoji Not number, not letter, just emoji.不是数字,不是字母,只是表情符号。 Without using emoji_picker package使用emoji_picker package

To open the emoji container emoji_picker打开表情符号容器emoji_picker

Create A method emojiContainer创建一个方法 emojiContainer

 emojiContainer() {
  return EmojiPicker(
      bgColor: Colors.red,
      indicatorColor: Colors.blue,
      rows: 3,
      columns: 7,
      onEmojiSelected: (emoji, category) {
        setState(() {
          isWriting = true;
        });

        textFieldController.text = textFieldController.text + emoji.emoji;
      },
      recommendKeywords: ["face", "happy", "party", "sad"],
      numRecommended: 50,
    );
  }

And use an onPressed并使用 onPressed

onPressed: () {
                    if (!showEmojiPicker) {
                      // keyboard is visible
                      hideKeyboard();
                      showEmojiContainer();
                    } else {
                      //keyboard is hidden
                      showKeyboard();
                      hideEmojiContainer();
                    }
                  },

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM