flutter_weixin 0.0.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 53

flutter_weixin #

微信分享到好友和朋友圈

Getting Started #

一.添加分享结果监听 1.android添加方式 WXEntryActivity只要继承FWXEntryActivity即可,无须在实现IWXAPIEventHandler。

<activity
    android:name="xxxx.wxapi.WXEntryActivity"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    android:exported="true"
    android:taskAffinity="net.sourceforge.simcpux"
    android:launchMode="singleTask">
</activity>
2.ios添加方式,除了基本按照文章上配置还需添加以下几个方法

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    return  [FlutterWeixinPlugin handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    return  [FlutterWeixinPlugin handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options{
    return  [FlutterWeixinPlugin handleOpenURL:url];
}

注意:不知道是不是我这边环境问题还是什么原因,引用的时候提示找不到WechatOpenSDK库
    解决方法是在对应ios工程Podfile最下面添加下面两句话可以解决,具体什么原因还不清楚,知道的同学麻烦告知下
    source 'https://github.com/CocoaPods/Specs.git'
    pod 'WechatOpenSDK'

二.使用

1.初始化
    FlutterWeixin.init(wxId);
    或
    FlutterWeixin.init(wxId).then((result) {

    }).catchError((err){

    });

2.分享文本给好友
    FlutterWeixin.shareToSession(description: "friend test desciption");

3.分享文本到朋友圈
    FlutterWeixin.shareToTimeline(title : "pyq test title");

4.分享图片到好友
    FlutterWeixin.shareToSession(imgUrl: "图片网络地址" (或imgPath: "图片FilePath" 或imgData: Uint8List));
    Uint8List 截屏的数据

5.分享图片到朋友圈
    FlutterWeixin.shareToTimeline(imgUrl: "图片网络地址" (或imgPath: "图片FilePath" 或imgData: Uint8List));
    Uint8List 截屏的数据

 4.分享网页到好友
    FlutterWeixin.shareToSession(title : "test title", description: "test desciption", webUrl: "https://www.baidu.com",
        webImgUrl:  "图片网络地址" (或webImgPath: "图片FilePath"));

5.分享网页到朋友圈
    FlutterWeixin.shareToTimeline(title : "test title", description: "test desciption", webUrl: "https://www.baidu.com",
                 webImgUrl:  "图片网络地址" (或webImgPath: "图片FilePath"));

备注:所有方法都可以通过下面方式监听分享结果
    xxxxx.then((result) {

    }).catchError((err) {

    });

三.说明 1.插件源码 https://github.com/ZhangLiuCheng/flutter_weixin 2.时间比较紧,只抽了基本分享方法,有兴趣的可以一起加入,flutter插件qq群 176880648

0.0.6 #

添加插件源码地址

example/README.md

flutter_weixin_example #

Demonstrates how to use the flutter_weixin plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_weixin: ^0.0.6

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_weixin/flutter_weixin.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
10
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

We analyzed this package on Nov 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

7 out of 7 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/flutter_weixin.dart.

Run flutter format to format lib/flutter_weixin.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test