Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

同一个页面怎么支持多个自定义键盘? #22

Closed
ko1o opened this issue Jul 24, 2019 · 8 comments
Closed

同一个页面怎么支持多个自定义键盘? #22

ko1o opened this issue Jul 24, 2019 · 8 comments

Comments

@ko1o
Copy link

ko1o commented Jul 24, 2019

比如聊天页面有多个自定义键盘,如何支持呢?目前我注册多个键盘 ,并自定义键盘就不生效,麻烦作者有时间看下哈~

@Im-Kevin
Copy link
Owner

能贴代码和例子看看吗

@ko1o
Copy link
Author

ko1o commented Jul 24, 2019

1、Register

  @override
  void initState() {
    super.initState();

    EmojiKeyboard.register();
    MoreKeyboard.register();
}

2、Iint

   // 初始化自定义键盘
    CoolKeyboard.init(cxt);

3、Usage

CupertinoTextField(
    controller: _textEditingController,
    padding: EdgeInsets.only(
        left: 6, top: 2, bottom: 2, right: 6),
    focusNode: _textFieldFocunNode,
    placeholder: "输入新消息",
    maxLines: 10,
    textInputAction: TextInputAction.send,
    keyboardType:
        _keyboardType == ChatKeyboardType.emoji
            ? EmojiKeyboard.inputType
            : (_keyboardType ==
                    ChatKeyboardType.more
                ? MoreKeyboard.inputType
                : TextInputType.text),
    onSubmitted: (value) {
        _textEditingController.clear();
        _textFieldFocunNode.unfocus();
    },
    style: TextStyle(
        fontSize: 14,
        fontWeight: FontWeight.w400,
        color: Colors.black),
    )
),

@Im-Kevin
Copy link
Owner

是怎么不生效,是不会切换,还是说所有的都没有弹出

@ko1o
Copy link
Author

ko1o commented Jul 24, 2019

是会被覆盖掉,后面注册的自定义键盘覆盖了前面自定义注册的键盘。

@Im-Kevin
Copy link
Owner

是不是只有最后注册的键盘可以用

@ko1o
Copy link
Author

ko1o commented Jul 24, 2019

麻烦提供个邮箱 我写了个Demo 私发下 @Im-Kevin

@Im-Kevin
Copy link
Owner

468561207@qq.com
我的代码应该是没有这个Bug的,是不是你两个键盘的inputType填写的是一样的

@Im-Kevin
Copy link
Owner

Im-Kevin commented Aug 5, 2019

问题已修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants