GitHub在這里活烙,時間原因,后續(xù)會更新功能遣鼓,歡迎star啸盏,issues!
使用前請先閱讀支付寶開放平臺官方文檔
功能:
分享文字
分享圖片Url
分享圖片通過UInt8List
分享網(wǎng)頁(縮略圖Url)
分享網(wǎng)頁(縮略圖UInt8List)
Dependencies
dependencies:
flutter_apopen: ^${latestVersion}
初始化注冊:
import 'package:flutter_apopen/flutter_apopen.dart' as apopen;
apopen.registerAP(appId: "your app id");
分享:
支付寶9.9.5版本后,scene整合在了一起骑祟,所以會話和發(fā)布動態(tài)不做處理回懦。
單獨分享文字:
void shareText() async {
var result = await apopen.shareText('This is a Share Text');
print(result);
}
分享圖片URL:
void shareText() async {
var result = await apopen.shareText('This is a Share Text');
print(result);
}
分享圖片通過UInt8List:
void shareImageData() async{
String assetPath = 'images/test.png';
ByteData byteData = await rootBundle.load(assetPath);
Uint8List pngBytes = byteData.buffer.asUint8List();
var result = await apopen.shareImageData(pngBytes);
print(result);
}
分享網(wǎng)頁,縮略圖Url
void shareWebWithImageUrl() async{
var result = await apopen.shareWebAndImgUrl(
imageUrl: 'http://XXX.jpg',
wepageUrl: 'https://www.XXX.com',
title: 'Text Title',
desc: 'Text desc',
);
print(result);
}
分享網(wǎng)頁曾我,縮略圖UInt8List
void shareWebWithImageData() async{
String assetPath = 'images/test.png';
ByteData byteData = await rootBundle.load(assetPath);
Uint8List pngBytes = byteData.buffer.asUint8List();
var result = await apopen.shareWebAndImgData(
imageData: pngBytes,
wepageUrl: 'https://www.XXX.com',
title: 'Text Title',
desc: 'Text desc',
);
print(result);
}