diff --git a/lib/widgets/share/share_alert.dart b/lib/widgets/share/share_alert.dart index 7f900e7..9d8de49 100644 --- a/lib/widgets/share/share_alert.dart +++ b/lib/widgets/share/share_alert.dart @@ -278,8 +278,8 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { if (path != null && path != '') { params = SSDKMap() ..setGeneral( - widget.model?.title ?? '', - widget.model?.content ?? '', + widget.model?.title ?? '图片分享', + widget.model?.content ?? '更多好事物', Platform.isIOS ? path : null, null, Platform.isAndroid ? path : null, @@ -300,6 +300,8 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { type = SSDKContentTypes.image; } else if (widget?.model?.title != null || widget.model?.content != null) { type = SSDKContentTypes.text; + } else if (widget?.model?.poster != null) { + type = SSDKContentTypes.image; } if (plateform == ShareSDKPlatforms.qZone && widget?.model?.content != null) { widget?.model?.title = null; @@ -340,8 +342,8 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { params = SSDKMap() ..setGeneral( - widget.model?.title ?? '', - widget?.model?.content ?? '', + widget.model?.title ?? '~', + widget?.model?.content ?? '~', Platform.isIOS ? widget.model.image : null, Platform.isAndroid ? (isExistImage ? widget?.model?.image?.first : null) : null, null, @@ -353,6 +355,38 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { type, ); } + + var isExistImage = false; + + if (widget?.model?.image != null && widget?.model?.image?.length > 0) { + isExistImage = true; + } + + ///新浪分享图片 + if (plateform == ShareSDKPlatforms.sina && + (isExistImage || widget?.model?.poster != null) && + EmptyUtil.isEmpty(widget?.model?.content) && + EmptyUtil.isEmpty(widget?.model?.url)) { + SSDKMap params2 = SSDKMap() + ..setSina( + "图片分享", + null, + null, + null, + null, + null, + null, + null, + false, + (isExistImage ? widget?.model?.image.first : null), + params.map["imagePath_android"], + SSDKContentTypes.image, + ); + print(params2); + SharesdkPlugin.share(ShareSDKPlatforms.sina, params2, (SSDKResponseState state, Map userdata, Map contentEntity, SSDKError error) {}); + return; + } + SharesdkPlugin.share(plateform, params, (SSDKResponseState state, Map userdata, Map contentEntity, SSDKError error) { print(error); if (state == SSDKResponseState.Fail) { diff --git a/lib/widgets/share/share_alert_select.dart b/lib/widgets/share/share_alert_select.dart index 3ad0da9..3e220d3 100644 --- a/lib/widgets/share/share_alert_select.dart +++ b/lib/widgets/share/share_alert_select.dart @@ -493,6 +493,38 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { type, ); } + + var isExistImage = false; + + if (widget?.model?.image != null && widget?.model?.image?.length > 0) { + isExistImage = true; + } + + ///新浪分享图片 + if (plateform == ShareSDKPlatforms.sina && + (isExistImage || widget?.model?.poster != null) && + EmptyUtil.isEmpty(widget?.model?.content) && + EmptyUtil.isEmpty(widget?.model?.url)) { + SSDKMap params2 = SSDKMap() + ..setSina( + "图片分享", + null, + null, + null, + null, + null, + null, + null, + false, + (isExistImage ? widget?.model?.image.first : null), + params.map["imagePath_android"], + SSDKContentTypes.image, + ); + print(params2); + SharesdkPlugin.share(ShareSDKPlatforms.sina, params2, (SSDKResponseState state, Map userdata, Map contentEntity, SSDKError error) {}); + return; + } + SharesdkPlugin.share(plateform, params, (SSDKResponseState state, Map userdata, Map contentEntity, SSDKError error) { print(error); if (state == SSDKResponseState.Fail) {