Buscar pacotes e repositórios

Repositório GitHubvincekruger/flutter_whatsapp_stickers

flutter_whatsapp_stickers

Plugin de Adesivos do WhatsApp para Flutter

Capa do projeto flutter_whatsapp_stickers
Estrelas
40
Forks
30
Último push (UTC)
21 de jan. de 2025
Status do projeto
Ativo

README original

Texto original em inglês. Visite o GitHub para a versão atual.

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);
}
Vince Kruger GitHub avatar
Autor no GitHub

Vince Kruger ↗

🌟 I'm on a quest to cook up rad tech creations with a sprinkle of digital biodegradable glitter for myself and our wonderful communities 💻🚀

Spain
LinguagensJavaDartRubySwiftObjective-C

Categorias

Pacotes publicados por este repositório

Dependências usadas

Lista de dependências 4 itens

Como escolher um repositório para seu projeto?

Filtre pelo caso de uso, compare a atividade e confira o projeto original antes de adotá-lo.

  1. Busque por nome, autor ou descrição e filtre por tema.
  2. Compare estrelas, forks e envios recentes. Estrelas indicam interesse, mas não garantem qualidade.
  3. Confira o README, a licença e as issues no GitHub antes de usar o projeto.

Fontes e manutenção

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗