搜尋套件、儲存庫與 APP 分類

套件詳情v2.5.1

flutter_emoji

一個輕量級的 Emoji 套件,適用於 Flutter,包含所有最新表情符號,充滿愛心製作,盡情享受吧!

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2.4萬
喜歡數
199
Pub 分數
150

安裝套件

flutter pub add flutter_emoji

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個輕量級的 Flutter 套件,提供對最新表情符號的存取,設計用於輕鬆整合到應用程式中。支援所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。此套件會定期更新以包含新表情符號,並以簡單性與效能為設計核心。適合透過具表現力且最新的表情符號內容來增強使用者介面,而不會增加額外負擔。

適用情境

  • 向文字小部件添加表情符號
  • 建立聊天或訊息介面
  • 透過富有表現力的圖示增強使用者介面
  • 支援社群媒體風格的內容
  • 顯示表情符號反應

主要特色

  • 最新表情符號集
  • 跨平台支援
  • 輕量級大小
  • 易於使用的 API
  • 定期更新

適合對象

  • 簡單的表情符號顯示
  • 聊天應用
  • 使用者產生的內容
  • 社交功能
  • 面向全球受眾的應用

使用建議

  • 可能需要手動更新以支援稀有或新發布的表情符號
  • 超出基本渲染之外的自定功能有限
  • 無內建表情符號選擇器
  • 依賴外部來源取得表情符號資料
  • 未針對大型表情符號密集型佈局進行優化

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

flutter_emoji

Build Status Coverage

Null Safety

👉 A light-weight Emoji 📦 for Flutter and Dart-based applications with all up-to-date emojis 😄. Made from 💯% ☕ with ❤️!

Inspired from the node-emoji package.

Update: since v2.3.4+, support all emojis listed in Unicode 13.0.

NOTE: I initially created this package to support my Flutter apps. However, Dart is growing to support on more platforms, so starting from v2.4.0+, this package will be available to all types of Dart-based applications.

Work in progress

I'm working on the new version of the package, it might or might not introduce breaking changes but I will try to maintain the compatibility in the API.

Here are few upcoming update to the v3:

  • Support Unicode 15.1+ emojis.
  • Skin tone
  • Group (category) of the emojis
  • Emoji version
  • Few new methods for handling/manipulating emojis.

Installation

Add this into pubspec.yaml

dependencies:
  flutter_emoji: ">= 2.0.0"

API Usage

First, import the package:

import 'package:flutter_emoji/flutter_emoji.dart';

There are two main classes you need to know to handle Emoji text: Emoji and EmojiParser.

Basically, you need to initialize an instance of EmojiParser and call its methods.

var parser = EmojiParser();
var coffee = Emoji('coffee', '☕');
var heart  = Emoji('heart', '❤️');

// Get emoji info
var emojiHeart = parser.info('heart');
print(emojiHeart); '{name: heart, full: :heart:, code: ❤️}'

// Check emoji equality
heart == emojiHeart;  // returns: true
heart == emojiCoffee; // returns: false

// Get emoji by name or code
parser.get('coffee');   // returns: Emoji{name="coffee", full=":coffee:", code="☕"}
parser.get(':coffee:'); // returns: Emoji{name="coffee", full=":coffee:", code="☕"}

parser.hasName('coffee'); // returns: true
parser.getName('coffee'); // returns: Emoji{name="coffee", full=":coffee:", code="☕"}

parser.hasEmoji('❤️'); // returns: true
parser.getEmoji('❤️'); // returns: Emoji{name="heart", full=":heart:", code="❤️"}

parser.emojify('I :heart: :coffee:'); // returns: 'I ❤️ ☕'
parser.unemojify('I ❤️ ☕'); // returns: 'I :heart: :coffee:'

// Count number of present emojis
parser.count('I ❤️ Flutter just like ☕'); // returns: 2

// Count frequency of a specific emoji
parser.frequency('I ❤️ Flutter just like ☕', '❤️'); // returns: 1

// Replace a specific emoji by another emoji
parser.replace('I ❤️ coffee', '❤️', '❤️‍🔥'); // returns: 'I ❤️‍🔥 coffee'

// Get a list of all emojis from the input
parser.parseEmojis('I ❤️ Flutter just like ☕'); // returns: ['❤️', '☕']

All methods will return Emoji.None if emoji is not found, except these two emojify() and unemojify() that will return original input.

parser.get('does_not_exist_emoji_name'); // returns: Emoji.None
Initialize emoji data for EmojiParser

There are two available datasets available you can choose to initialize for EmojiParser: local and server.

// to load local dataset
var localParser1 = EmojiParser();
var localParser2 = EmojiParser(init: false);
localParser2.initLocalData();

// to load server dataset
// this will trigger an URL request to download latest emoji data
var serverParser = EmojiParser(init: false);
await serverParser.initServerData(); // make sure to wrap in an `async` function/method.

NOTE: make sure to add Internet permission on Android.

<!-- Required to fetch data from the internet. -->
<uses-permission android:name="android.permission.INTERNET" />

In any occasion that local dataset doesn't have the latest emojis, load server dataset instead. If it is still not working, please create an issue or pull request to the repo.

TODO

Features coming to this package:

  • [x] Get detail of an emoji.
  • [x] Refactor for easier usage.
  • [x] Validate bad input.
  • [x] Find list of available emojis from a given text.
  • [x] Replace emoji by another one.
  • [x] Callback for additional formatting found emojis.
  • [x] Ability to fetch latest emoji list.
  • [ ] Make extensible emoji matcher.

License

MIT @ 2019 Pete Houston.

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案