share method
void
share({
分享
platform
平台类型
shareInfo
分享数据
Implementation
void share({
required String appId,
required SharePlatform platform,
required ShareInfo shareInfo,
required Function(SharePlatform platform, ShareResultType resultType) shareCall,
}) {
CloudChannelManager.instance.send(_shareMethodName, arguments: {
"appId": appId,
"platform": platform.name,
"title": shareInfo.title,
"link": shareInfo.link,
"logo": shareInfo.logo,
"image": shareInfo.images.isEmptyList ? "" : shareInfo.images.first,
"content": shareInfo.content,
"shareType": shareInfo.shareType,
"suffix": shareInfo.link.suffixName,
}).then((resultMap) {
var status = "${resultMap["status"] ?? ""}";
if (status == "success") {
if (platform == SharePlatform.wechat) {
shareCall(platform, ShareResultType.success);
}
} else if (status == "cancel") {
shareCall(platform, ShareResultType.cancel);
} else if (status == "error") {
shareCall(platform, ShareResultType.error);
}
shareCall(platform, ShareResultType.complete);
});
Future.delayed(const Duration(milliseconds: 1000), () {
shareCall(platform, ShareResultType.complete);
});
}