搜尋分類、套件與程式碼儲存庫

套件詳情v1.0.1+5

flutter_whatsapp_stickers

用於在您的 Flutter 應用中新增 WhatsApp 貼紙的 Flutter 外掛程式。

Android
近 30 天下載
8
喜歡數
61
Pub 分數
145

安裝套件

flutter pub add flutter_whatsapp_stickers

套件介紹

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

一個 Flutter 插件,可直接在 Flutter 應用中整合 WhatsApp 貼紙。它允許使用者建立、管理並透過 WhatsApp 分享自訂貼紙,以富有表現力的視覺效果增強聊天體驗。此插件專為 Android 設計,提供簡單直觀的 API 來處理貼紙套件及其相關資料。它支援 WhatsApp 貼紙格式需求,讓從 Flutter 應用內打包與分發貼紙變得輕鬆。

適用情境

  • 在 WhatsApp 聊天中分享自定表情符號
  • 將貼紙套件整合到通訊應用中
  • 啟用使用者產生的貼紙內容
  • 向應用添加互動貼紙功能
  • 建立品牌貼紙收藏

主要特色

  • 僅支援 Android
  • 貼紙包管理的簡單 API
  • 支援 WhatsApp 貼紙格式
  • 與 Flutter 應用輕鬆整合
  • 處理元數據和圖像資源

適合對象

  • 開發訊息應用的開發者
  • 專注於使用者產生內容的應用
  • 品牌貼紙分發平台
  • 貼紙設計的創意工具
  • Android優先的Flutter應用

使用建議

  • 僅限Android平台
  • 需要遵守 WhatsApp 貼紙規範
  • 無 iOS 支援
  • 貼紙包必須格式正確
  • 可能需要額外的資源處理

原始 README

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

WhatsApp Stickers plugin for Flutter

pub package

This plugin is still under development and for now, only Android is supported. Feedback and Pull Requests are welcome!

I'm in the process of rebuilding this plugin and the new version will be released at the end of October 🤞

Getting Started

Add flutter_whatsapp_stickers as a dependency in your pubspec.yaml file.

Check out the example directory for a sample app.

Android Configuration

Add the following option to your app\build.gradle file. This will prevent all WebP files from being compressed.

android {
    aaptOptions {
        noCompress "webp"
    }
}
Packaged Assess

You need to include your assets in your pubspec.yaml file.

flutter:
  assets:
    - sticker_packs/sticker_packs.json
    - sticker_packs/1/
Dynamic Content

If you are using assets that are not bundled in your build, then you need to add the following to your Manifest file. Note that you cannot use both.

<meta-data android:name="NonAssetContentProvider" android:value="true" />
Sticker Pack Contents File

To change the stickers packs file, add this Build Config Field to your app\build.gradle file. The default is sticker_packs.json.

buildConfigField("String", "STICKER_PACK_FILE", "\"sticker_packs.json\"")

iOS Integration

Currently, there is no iOS support. Pull requests for this are more than welcome for this.

Methods

Check if WhatsApp is installed.

bool whatsAppInstalled = await WhatsAppStickers.isWhatsAppInstalled;

Check if the WhatsApp Consumer package is installed

bool whatsAppConsumerAppInstalled = await WhatsAppStickers.isWhatsAppConsumerAppInstalled;

Check if the WhatsApp Business package app is installed

bool whatsAppSmbAppInstalled = await WhatsAppStickers.isWhatsAppSmbAppInstalled;

Check if a sticker pack is installed.

_stickerPackInstalled = await WhatsAppStickers().isStickerPackInstalled(_stickerPackIdentifier);

Add a sticker pack to WhatsApp.

WhatsAppStickers().addStickerPack(
  packageName: WhatsAppPackage.Consumer,
  stickerPackIdentifier: _stickerPackIdentifier,
  stickerPackName: _stickerPackName,
  listener: _listener,
);

Updated Sticker Pack contents and notify listeners

WhatsAppStickers().updatedStickerPacks(_stickerPackIdentifier);

The Add Sticker Pack Listener

Future<void> _listener(StickerPackResult action, bool result, {String error}) async {
    // Do what you must here
}

Here is an example of how to create a custom stickers_packs.json file.

void createLocalFile() async {
  String dir = (await getApplicationDocumentsDirectory()).path;
  Directory stickersDirectory = Directory("$dir/sticker_packs");
  if (!await stickersDirectory.exists()) {
    await stickersDirectory.create();
  }

  File jsonFile = File('$dir/sticker_packs/sticker_packs.json');
  String content = jsonEncode(stickerPacks);
  jsonFile.writeAsStringSync(content);
}

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。