All Projects → pj0579 → flutter_wechat

pj0579 / flutter_wechat

Licence: MIT license
flutter wechat

Programming Languages

dart
5743 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to flutter wechat

Flutter statusbarcolor
A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically.
Stars: ✭ 203 (+167.11%)
Mutual labels:  flutter-plugin
Flutter plugin record
flutter 仿微信录制语音功能 支持android和ios
Stars: ✭ 214 (+181.58%)
Mutual labels:  flutter-plugin
Flutter Nfc Reader
Flutter NFC reader plugin for iOS and Android
Stars: ✭ 240 (+215.79%)
Mutual labels:  flutter-plugin
Plugins
Plugins for Flutter maintained by the Flutter team
Stars: ✭ 14,956 (+19578.95%)
Mutual labels:  flutter-plugin
Scratcher
Scratch card widget which temporarily hides content from user.
Stars: ✭ 210 (+176.32%)
Mutual labels:  flutter-plugin
Betterplayer
Better video player for Flutter, with multiple configuration options. Solving typical use cases!
Stars: ✭ 205 (+169.74%)
Mutual labels:  flutter-plugin
Flutter crashlytics
📦 Flutter plugin for Crashlytics integration
Stars: ✭ 193 (+153.95%)
Mutual labels:  flutter-plugin
FlutterToastPlugin
A new Flutter plugin for showing toast in android and ios.
Stars: ✭ 21 (-72.37%)
Mutual labels:  flutter-plugin
App review
App Review - Request and Write Reviews and Open Store Listing for Android and iOS in Flutter. Maintainer: @rodydavis
Stars: ✭ 213 (+180.26%)
Mutual labels:  flutter-plugin
Sqfentity
SqfEntity ORM for Flutter/Dart lets you build and execute SQL commands on SQLite database easily and quickly with the help of fluent methods similar to .Net Entity Framework. SqfEntity also generates add/edit forms with validations and special controls (DropDown List, DateTime pickers, Checkboxes.. etc) for your table.
Stars: ✭ 237 (+211.84%)
Mutual labels:  flutter-plugin
Flutterexampleapps
[Example APPS] Basic Flutter apps, for flutter devs.
Stars: ✭ 15,950 (+20886.84%)
Mutual labels:  flutter-plugin
Flutter speed dial
Flutter plugin to implement a Material Design Speed Dial
Stars: ✭ 206 (+171.05%)
Mutual labels:  flutter-plugin
Flutter fluid slider
A fluid design slider that works just like the Slider material widget.
Stars: ✭ 232 (+205.26%)
Mutual labels:  flutter-plugin
Geolocation
Flutter geolocation plugin for Android and iOS.
Stars: ✭ 205 (+169.74%)
Mutual labels:  flutter-plugin
flutter bolg manage
Flutter实战项目,采用Getx框架管理,遵循Material design设计风格,适合您实战参考或练手
Stars: ✭ 373 (+390.79%)
Mutual labels:  flutter-plugin
Flutter Credit Card Input Form
Flutter Credit Card Input form
Stars: ✭ 201 (+164.47%)
Mutual labels:  flutter-plugin
Flutter rating bar
A simple ratingbar for flutter which also include a rating bar indicator, supporting any fraction of rating.
Stars: ✭ 211 (+177.63%)
Mutual labels:  flutter-plugin
playify
Playify is a Flutter plugin for play/pause/seek songs, fetching music metadata, and browsing music library.
Stars: ✭ 32 (-57.89%)
Mutual labels:  flutter-plugin
firebase dart sdk
Unofficial Firebase Flutter SDK. Maintainer: @long1eu
Stars: ✭ 84 (+10.53%)
Mutual labels:  flutter-plugin
Flip box bar
A 3D Bottom Navigation Bar in Flutter
Stars: ✭ 236 (+210.53%)
Mutual labels:  flutter-plugin

flutter_wechat

A flutter plugin to use wechat. 测试使用暂时不维护了 有需要的请使用 https://github.com/OpenFlutter/fluwx

Features

  • Add Login
  • Add Pay
  • Support LocalImage
  • Support 分享小程序

Install

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_wechat: "^0.1.5"

Getting Started

  • Android
    • For Android, you must do the following before you can use the plugin: Add the permissions to your AndroidManifest.xml
       <uses-permission android:name="android.permission.INTERNET" />
       <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
       <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
       <uses-permission android:name="android.permission.READ_PHONE_STATE" />
       <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
       <uses-permission android:name="android.permission.WRITE_SETTINGS" />
      
      如果想要响应微信分享登录resp需要在mainActivity同级目录下创建wxapi文件夹 下面新建WXEntryACtivity集成Activity(需要在AndroidManifest.xml注册)
    <activity android:name=".wxapi.WXEntryActivity" android:exported="true" android:launchMode="singleTop"/>
    private IWXAPI api;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        api = WXAPIFactory.createWXAPI(this, "wxb25d3dec3db1affc", false);
        onNewIntent(getIntent());
        finish();
    }

        @Override
    public void onReq(BaseReq baseReq) {

    }

    @Override
    public void onResp(BaseResp baseResp) {
        sendBroadcastToWechat(baseResp);
    }

    private void sendBroadcastToWechat(BaseResp baseResp) {
        Intent intent = new Intent();
        intent.setAction("sendResp");
        if (baseResp instanceof SendAuth.Resp) {
            SendAuth.Resp resp = (SendAuth.Resp) (baseResp);
            intent.putExtra("code", resp.errCode == 0 ? resp.code : "-1");
            intent.putExtra("type", "SendAuthResp");
            sendBroadcast(intent);
        } else {
            intent.setAction("sendResp");
            intent.putExtra("code", baseResp.errCode + "");
            intent.putExtra("type", "ShareResp");
            sendBroadcast(intent);
        }
    }
    protected void onNewIntent(Intent intent) {
        api.handleIntent(intent, this);
    }

如果想要响应微信支付resp需要在mainActivity同级目录下创建wxapi文件夹(需要在AndroidManifest.xml注册)

<activity
  android:name=".wxapi.WXPayEntryActivity"
  android:exported="true"
  android:launchMode="singleTop">

  <intent-filter>
      <action android:name="android.intent.action.VIEW"/>
      <category android:name="android.intent.category.DEFAULT"/>
      <data android:scheme="your AppId"/>
  </intent-filter>
</activity>

     下面新建WXEntryACtivity集成Activity

public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {


   private IWXAPI api;

   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       api = WXAPIFactory.createWXAPI(this, "wxb25d3dec3db1affc", false);
       onNewIntent(getIntent());
       finish();
   }

   @Override
   public void onReq(BaseReq baseReq) {

   }

   @Override
   public void onResp(BaseResp baseResp) {
       sendBroadcastToWechat(baseResp);
   }

   private void sendBroadcastToWechat(BaseResp baseResp) {
       Intent intent = new Intent();
       intent.setAction("sendResp");
       intent.putExtra("code", baseResp.errCode + "");
       intent.putExtra("type", "PayResp");
       sendBroadcast(intent);
   }

   protected void onNewIntent(Intent intent) {
       api.handleIntent(intent, this);
   }


}
// ios 8.x or older
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
     NSString * urlStr = [url absoluteString];
    [[NSNotificationCenter defaultCenter]
     postNotificationName:@"WeChat" object:nil userInfo:@{@"url":urlStr}];
    return YES;
}
// ios 9.0+
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
            options:(NSDictionary<NSString*, id> *)options
{
    NSString * urlStr = [url absoluteString];
    [[NSNotificationCenter defaultCenter]
     postNotificationName:@"WeChat" object:nil userInfo:@{@"url":urlStr}];
    return YES;
}

How to use

import 'package:flutter_wechat/flutter_wechat.dart';
      分享返回错误码 0为正确 -1 -2 -3- 4- 5
      登录成功返回 access_code 登录错误返回 -1
      支付成功返回 0为正确  -1 -2
注册
await FlutterWechat.registerWechat("wxxxxxx").then((state){print(state)});// 微信注册需要在你需要的地方注册,最好是app首页
分享
await FlutterWechat.shareText(text: "test", type:0,).then((state){print(state)});//文字分享 type 0 聊天页面 1 朋友圈
await FlutterWechat.shareImage(imgUrl: "xxx", type:0,).then((state){print(state)});
await FlutterWechat.shareMusic(imgUrl: "xxx", musicUrl:"",title:"",description:"",musicDataUrl:"",musicLowBandDataUrl:"",musicLowBandUrl:"",type:0,).then((state){print(state)});
await FlutterWechat.shareVideo(imgUrl: "xxx", videoUrl:"",title:"",description:"",videoLowBandUrl:"",type:0,).then((state){print(state)});
await FlutterWechat.shareWebPage(imgUrl: "xxx", webpageUrl:"",title:"",description:"",type:0,).then((state){print(state)});
登录
await FlutterWechat.login(scope:"",state:"").then((state){print(state)});
支付
await FlutterWechat.pay(partnerId: "",prepayId: "",nonceStr: "",timeStamp: "",sign: "",package: "",appId: "",).then((state){print(state)});//具体参考微信参数传递
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].