搜索分类、插件与代码仓

插件详情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 项

源码仓库

使用此插件的项目

暂无相关数据。