GithubHelp home page GithubHelp logo

zxzx74147 / flutter_whatsapp_stickers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vincekruger/flutter_whatsapp_stickers

0.0 2.0 0.0 1.91 MB

WhatsApp Stickers Plugin for Flutter

Home Page: https://pub.dev/packages/flutter_whatsapp_stickers

License: BSD 3-Clause "New" or "Revised" License

Ruby 7.01% Objective-C 0.62% Java 59.81% Dart 30.83% Swift 1.74%

flutter_whatsapp_stickers's Introduction

WhatsApp Stickers plugin for Flutter

pub package

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

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);
}

flutter_whatsapp_stickers's People

Contributors

vincekruger avatar anmolsethi avatar swapkumbhar31 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.