flutter_alibc 0.0.8

  • Readme
  • Changelog
  • Example
  • Installing
  • 74

flutter_alibc #

Flutter版本的阿里百川 V4.0.2版本

pub地址:flutter_alibc github地址:flutter_alibc

可以给个star🐴,混口饭吃

支持Android和iOS

Android:983598009@qq.com iOS:329106954@qq.com P.S:另有开普勒插件flutter_kepler

Getting Started #

工程性配置 #

参考阿里百川官网

引入 #

如何引入项目

方法说明 #

  • 头文件引入
import 'package:flutter_alibc/flutter_alibc.dart';
  • 初始化
 /**
   * 初始化
   * version:当前app版本
   * appName:当前app名称
   * result:{
   * errorCode,     //0为初始化成功,其他为失败
   * errorMessage,  //message
   * }
   */
var result = await FlutterAlibc.initAlibc(version:"",appName:"");
  • 登录淘宝
/**
   * 登录淘宝
   * version:当前app版本
   * appName:当前app名称
   * result:{
   * errorCode,     //0为初始化成功,其他为失败
   * errorMessage,  //message
   * data:{					//登录成功的情况下返回data,为用户数据
   * 	//nick 用户昵称,avatarUrl 头像地址
	 *  nick,avatarUrl,openId,openSid,topAccessToken,topAuthCode
   * 	}
   * }
   * 备注:登录过会直接返回淘宝用户的信息,不会多次唤醒淘宝,请放心
   */
var result = await FlutterAlibc.loginTaoBao();
  • 淘宝登出
FlutterAlibc.loginOut();
  • 淘客登录,二次授权获取access_token
 /**
   * @description: 获取access_token
   * @param 
   * url:用于授权登录的url
   * openType:打开类型,默认auto
   * isNeedCustomNativeFailMode:是否需要设置唤端失败策略,默认false
   * nativeFailMode:唤端失败策略,默认None
   * schemeType:唤起哪个端,默认天猫
   * taokeParams:淘客数据
   * backUrl: 跳转回来的url
   * @return: {accessToken:""}//获取成功为token,获取失败为空字符串
   */
 var result = await FlutterAlibc.taoKeLogin(
                    url:"",	//必须参数,用于授权登录的url
                    openType : AlibcOpenType.AlibcOpenTypeAuto,
                    isNeedCustomNativeFailMode : false,
                    nativeFailMode :    AlibcNativeFailMode.AlibcNativeFailModeNone,
                    schemeType : AlibcSchemeType.AlibcSchemeTmall,
                    taokeParams : {},
                    backUrl:"",
                    );
  • 唤起淘宝,openByUrl方式
 /**
   * @description: 通过url打开,包括h5,唤起手淘等
   * @param 
   * url:目标url
   * openType:打开类型,默认auto
   * isNeedCustomNativeFailMode:是否需要设置唤端失败策略,默认false
   * nativeFailMode:唤端失败策略,默认None
   * schemeType:唤起哪个端,默认天猫
   * taokeParams:淘客数据
   * backUrl: 跳转回来的url
   * @return: {
   *		errorCode,
   *		errorMessage,
   *		type,			//0为添加购物车,1为付款成功
   *		payResult,	//type为1时返回
   *  }
   */
 var result = await FlutterAlibc.openByUrl(
                    url:"",	//必须参数
                    openType : AlibcOpenType.AlibcOpenTypeAuto,
                    isNeedCustomNativeFailMode : false,
                    nativeFailMode :    AlibcNativeFailMode.AlibcNativeFailModeNone,
                    schemeType : AlibcSchemeType.AlibcSchemeTmall,
                    taokeParams : {},
                    backUrl:"",
                    );
  • 唤起淘宝,openItemDetail方式
/**
   * @description: 打开商品详情
   * @param 
   * itemID 商品id,可以是真实的也可以是混淆的,必须参数
   * trackParam	需要额外追踪的业务数据
   * 其他同上
   * @return: 同openByUrl
   */
var result = await FlutterAlibc.openItemDetail(
										itemID:"",	//必须参数
                    openType : AlibcOpenType.AlibcOpenTypeAuto,
                    isNeedCustomNativeFailMode : false,
                    nativeFailMode :    AlibcNativeFailMode.AlibcNativeFailModeNone,
                    schemeType : AlibcSchemeType.AlibcSchemeTmall,
                    taokeParams : {},
                    trackParam : {}, //需要额外追踪的业务数据
                    backUrl:"",
);
  • 打开店铺,openShop方式
/**
   * @description: 打开店铺
   * @param 
   * shopId 店铺id,必须参数
   * 其他同上
   * @return: 同openByUrl
   */
var result = await FlutterAlibc.openShop(
										shopId:"",	//必须参数
                    openType : AlibcOpenType.AlibcOpenTypeAuto,
                    isNeedCustomNativeFailMode : false,
                    nativeFailMode :    AlibcNativeFailMode.AlibcNativeFailModeNone,
                    schemeType : AlibcSchemeType.AlibcSchemeTmall,
                    taokeParams : {},
                    trackParam : {}, //需要额外追踪的业务数据
                    backUrl:"",
);
  • 打开购物车,openCart方式
/**
   * @description: 打开购物车
   * @param 
   * 无必须参数
   * 其他同上
   * @return: 同openByUrl
   */
var result = await FlutterAlibc.openCart(
                    openType : AlibcOpenType.AlibcOpenTypeAuto,
                    isNeedCustomNativeFailMode : false,
                    nativeFailMode :    AlibcNativeFailMode.AlibcNativeFailModeNone,
                    schemeType : AlibcSchemeType.AlibcSchemeTmall,
                    taokeParams : {},
                    trackParam : {}, //需要额外追踪的业务数据
                    backUrl:"",
);
  • 是否设置同步打点
FlutterAlibc.syncForTaoke(true);
  • 是否使用Native Alipay
FlutterAlibc.useAlipayNative(true);

0.0.1 #

完成开发

  • TODO: Describe initial release.

0.0.2 #

修改readme

0.0.3 #

Android 修正缺少的接口参数

0.0.4 #

AndroidX 测试

0.0.5 #

1.修复Android与iOS逻辑不一致的地方 2.修复枚举混乱的问题 3.修复Android返回参数不正确的问题 4.通过openurl,openItem,openShop,openCart的返回值在失败的情况下,移除tradeFailResult这个失败的回调data(因为Android没有)

0.0.6 #

升级到百川V4.0.2版本 具体升级变动百川官方更新说明

0.0.7 #

1.修正iOS的回调,感谢JarvanMo 2.修正iOS不传入backUrl导致的崩溃问题

0.0.8 #

新增二次授权获取accessToken用于二次授权登录

example/README.md

flutter_alibc_example #

Demonstrates how to use the flutter_alibc 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_alibc: ^0.0.8

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_alibc/flutter_alibc.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
65
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
74
Learn more about scoring.

We analyzed this package on Nov 15, 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 suggestions

Fix lib/alibc_const_key.dart. (-1.49 points)

Analysis of lib/alibc_const_key.dart reported 3 hints:

line 8 col 8: Unused import: 'package:flutter/foundation.dart'.

line 20 col 17: Name non-constant identifiers using lowerCamelCase.

line 21 col 17: Name non-constant identifiers using lowerCamelCase.

Format lib/albc_tools.dart.

Run flutter format to format lib/albc_tools.dart.

Maintenance issues and suggestions

The description contains too many non-ASCII characters. (-20 points)

The site uses English as its primary language. The value of the description field in your package's pubspec.yaml field should primarily contain characters used in English.

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.

The package description is too short. (-10 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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