搜索分类、插件与代码仓

keyboard_emoji_picker 封面
插件详情v1.0.3

keyboard_emoji_picker

使用设备键盘选择表情符号的 Flutter 插件。

iOS
近 30 天下载
1220
喜欢数
31
Pub 分数
150

安装插件

flutter pub add keyboard_emoji_picker

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 插件,允许用户通过设备的原生键盘直接选择表情符号。它与 iOS 键盘无缝集成,可在不切换输入法的情况下流畅选择表情符号。该包通过提供快速访问表情符号的功能,提升了消息和文本输入界面的用户体验。它轻量级且专为 iOS 设计,利用平台特定的键盘功能。非常适合需要直观表情符号交互的应用。

适合场景

  • 消息应用
  • 社交媒体平台
  • 评论部分
  • 用户个人资料描述
  • 交互式聊天界面

主要特点

  • 原生 iOS 键盘集成
  • 无缝表情符号选择
  • 轻量级实现
  • 平台特定优化
  • 通过 Flutter pub 轻松设置

适合对象

  • 面向 iOS 的 Flutter 应用
  • 文本输入量大的应用
  • 情感丰富的沟通工具
  • 简单表情符号选择器需要
  • 注重原生用户体验的开发者

使用建议

  • 仅限 iOS
  • 无 Android 支持
  • 依赖设备键盘行为
  • 可能需要在不同版本的iOS上进行测试
  • 最小的自定义选项

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

The keyboard_emoji_picker package provides a simple way to use the device's native emoji keyboard to pick an emoji. It's currently supported on iOS only. However, adding support for Android is something I'd like to do in the future (if you'd like to help, please let me know).

Demo

Usage

To use KeyboardEmojiPicker, you need to have a KeyboardEmojiPickerWrapper widget somewhere in your widget tree. This widget will create a hidden input field in order to make opening the keyboard possible.

import 'package:keyboard_emoji_picker/keyboard_emoji_picker.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // While this example wraps [MaterialApp], you don't have to.
    // You can put it wherever you want to use the picker.
    return KeyboardEmojiPickerWrapper(
      child: MaterialApp(
        title: 'My App',
        home: MyHomePage(),
      ),
    );
  }
}
Checking if the keyboard is available

Since the package uses the device's keyboard, it's not always available. For example, if the user has disabled the emoji keyboard, it won't open and will throw a NoEmojiKeyboardFound exception.

To check if the keyboard is available, you can use the checkHasEmojiKeyboard method.

final hasEmojiKeyboard = await KeyboardEmojiPicker().checkHasEmojiKeyboard();

if (hasEmojiKeyboard) {
  // Open the keyboard.
} else {
  // Use another way to pick an emoji or show a dialog asking the user to
  // enable the emoji keyboard.
}
Picking an emoji

To pick an emoji, use the pickEmoji method. It will open the keyboard and wait for the user to pick an emoji. If the user closes the keyboard, the method will return null.

It is highly recommended to check if the keyboard is available before calling this method to avoid exceptions.

final emoji = await KeyboardEmojiPicker().pickEmoji();
if (emoji != null) {
  // Do something with the emoji
} else {
  // The emoji picking process was cancelled (usually, the keyboard was closed).
}
Closing the keyboard

Since the plugin uses a different hidden input than Flutter itself, you need to close the keyboard manually. To do so, use the closeKeyboard method.

KeyboardEmojiPicker().closeKeyboard();

Contributing

Contributions are welcome and appreciated! Feel free to open an issue or a pull request!

所属分类

依赖

依赖清单 1 项

  • plugin_platform_interface^2.0.2

源码仓库

使用此插件的项目

暂无相关数据。