From dd1c455a2ec19f16f9479840a69395fe5f4c5631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Tue, 9 Feb 2021 09:21:36 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=A4=9A=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/android/app/build.gradle | 58 +++++++++++------------ example/pubspec.yaml | 4 +- lib/widgets/share/share_alert_select.dart | 55 ++++++++++----------- 3 files changed, 59 insertions(+), 58 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 0e7c865..199de77 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -53,8 +53,8 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ndk { //选择要添加的对应cpu类型的.so库。 - abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a' - // abiFilters 'armeabi-v7a','x86_64' + //abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a' + abiFilters 'armeabi-v7a','x86_64' } } @@ -109,33 +109,33 @@ android { // // 应用信息配置 -// productFlavors { -// // 智夜生活 -// zhiying { -// applicationId "cn.zhios.zhiying" -// versionCode 45 -// dimension "app" -// versionName '1.3.3' -// // 签名信息 -// signingConfig signingConfigs.zhiying -// } -// } -// -// // 打包脚本 -// android.applicationVariants.all { variant -> -// if (variant.buildType.name != "debug") { -// variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk") -// } -// -// variant.outputs.all { output -> -// def outputFile = output.outputFile -// if (outputFile != null && outputFile.name.endsWith('.apk')) { -// //这里修改apk文件名 -// def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk" -// outputFileName = fileName -// } -// } -// } + productFlavors { + // 智夜生活 + zhiying { + applicationId "cn.zhios.zhiying" + versionCode 45 + dimension "app" + versionName '1.3.3' + // 签名信息 + signingConfig signingConfigs.zhiying + } + } + + // 打包脚本 + android.applicationVariants.all { variant -> + if (variant.buildType.name != "debug") { + variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk") + } + + variant.outputs.all { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.apk')) { + //这里修改apk文件名 + def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk" + outputFileName = fileName + } + } + } configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 50f362c..042618e 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -38,13 +38,13 @@ dev_dependencies: zhiying_moments: #path: ../zhiying_moments git: - ref: 0.1.5 + ref: 0.1.6 url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_moments.git #会员升级 zhiying_member_upgrade: #path: ../Zhiying_Member_Upgrade git: - ref: 0.0.1 + ref: 0.0.2 url: http://192.168.0.138:3000/FnuoOS_ZhiYing/Zhiying_Member_Upgrade.git # For information on the generic Dart part of this file, see the diff --git a/lib/widgets/share/share_alert_select.dart b/lib/widgets/share/share_alert_select.dart index 1f82b99..0183675 100644 --- a/lib/widgets/share/share_alert_select.dart +++ b/lib/widgets/share/share_alert_select.dart @@ -12,6 +12,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:fluttertoast/fluttertoast.dart'; +import 'package:more_picture_share/more_picture_share.dart'; import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:share_extend/share_extend.dart'; @@ -143,15 +144,19 @@ class _ShareAlertSelectState extends State { itemBuilder: (BuildContext context, int index) { Widget picWidget; if (index == 0) { - picWidget = Expanded( - child: Transform.scale( - alignment: Alignment.center, - scale: 0.75, - child: GoodsShareTemplate( - selectPicModel.posterModel, - contentKey: _globalKey, + picWidget = Column( + children: [ + Expanded( + child: Transform.scale( + alignment: Alignment.center, + scale: 0.75, + child: GoodsShareTemplate( + selectPicModel.posterModel, + contentKey: _globalKey, + ), + ), ), - ), + ], ); } else { picWidget = CachedNetworkImage( @@ -382,7 +387,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { } else if (item.type == 'weibo') { _shareByMob(ShareSDKPlatforms.sina); } else if (item.type == 'more_setting') { - _shareBySystem(); + _shareBySystem(item.type); } }, ); @@ -397,16 +402,6 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { Fluttertoast.showToast(msg: '请选择分享图片'); return; } - int count = 0; - if (_shareDataModel.poster != null) { - count++; - } - count += (_shareDataModel?.image?.length ?? 0); - // 多图分享 - if (count > 1) { - _shareMultipleImages(); - return; - } Loading.show(context); Timer(Duration(milliseconds: 2000), () { @@ -442,7 +437,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { } else if (_shareDataModel?.title != null || _shareDataModel?.content != null) { type = SSDKContentTypes.text; } - if (plateform == ShareSDKPlatforms.qZone) { + if (plateform == ShareSDKPlatforms.qZone && type == SSDKContentTypes.text) { _shareDataModel?.title = null; type = SSDKContentTypes.message; } @@ -462,8 +457,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { type, ); } - SharesdkPlugin.share(plateform, params, - (SSDKResponseState state, Map userdata, Map contentEntity, SSDKError error) { + SharesdkPlugin.share(plateform, params, (SSDKResponseState state, Map userdata, Map contentEntity, SSDKError error) { print(error); if (state == SSDKResponseState.Fail) { Fluttertoast.showToast(msg: '分享失败'); @@ -478,7 +472,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { } // 系统分享,只能分享图片或者文字,不能组合分享 - void _shareBySystem() async { + void _shareBySystem(String type) async { if (isSelectPic && EmptyUtil.isEmpty(_shareDataModel) && EmptyUtil.isEmpty(_shareDataModel?.poster) && @@ -486,6 +480,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { Fluttertoast.showToast(msg: '请选择分享图片'); return; } + int count = 0; if (_shareDataModel.poster != null) { count++; @@ -493,7 +488,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { count += (_shareDataModel?.image?.length ?? 0); // 多图分享 if (count > 1) { - _shareMultipleImages(); + _shareMultipleImages(type); return; } @@ -505,6 +500,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { } else { ShareExtend.share(_shareDataModel.content, 'text'); } + } Future _savePoster() async { @@ -538,17 +534,22 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { } // 多图分享,调用系统分享 - void _shareMultipleImages() async { + void _shareMultipleImages(String type) async { List paths = List(); String path = await _savePoster(); if (path != null && path != '') { paths.add(path); } - Loading.show(context); List downPaths = await ImageDownloadUtil.download(_shareDataModel.image); paths.addAll(downPaths); - ShareExtend.shareMultiple(paths, "image", subject: ""); + if (Platform.isAndroid && type == 'wx') { + MorePictureShare.shareWeixinPics(paths); + } else if (Platform.isAndroid && type == 'pyq') { + MorePictureShare.shareWeixinPicsCirlc(paths); + } else { + ShareExtend.shareMultiple(paths, "image", subject: ""); + } Loading.dismiss(); } }