From f0d5a7364fa2b8a19898ef326e4dd293a9e336a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”>
Date: Sat, 6 Feb 2021 10:45:56 +0800
Subject: [PATCH] =?UTF-8?q?1.=E5=BE=AE=E4=BF=A1=E5=A2=9E=E5=8A=A0=E5=A4=9A?=
=?UTF-8?q?=E5=9B=BE=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 | 54 +++++++++----------
.../android/app/src/main/AndroidManifest.xml | 21 +++++++-
.../src/main/res/xml/zhiying_file_path.xml | 3 ++
example/lib/util/localizations_delegate.dart | 8 +++
example/pubspec.yaml | 2 +-
lib/widgets/share/share_alert.dart | 42 ++++++++-------
pubspec.yaml | 5 +-
7 files changed, 87 insertions(+), 48 deletions(-)
create mode 100644 example/android/app/src/main/res/xml/zhiying_file_path.xml
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index d853403..67bbf41 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -108,33 +108,33 @@ android {
// 应用信息配置
- productFlavors {
- // 智夜生活
- zhiying {
- applicationId "cn.zhios.zhiying"
- versionCode 39
- dimension "app"
- versionName '1.2.39'
- // 签名信息
- 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 39
+// dimension "app"
+// versionName '1.2.39'
+// // 签名信息
+// 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/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
index 81ce7ed..4bf224b 100644
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -24,13 +24,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/android/app/src/main/res/xml/zhiying_file_path.xml b/example/android/app/src/main/res/xml/zhiying_file_path.xml
new file mode 100644
index 0000000..8bbbd5b
--- /dev/null
+++ b/example/android/app/src/main/res/xml/zhiying_file_path.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/example/lib/util/localizations_delegate.dart b/example/lib/util/localizations_delegate.dart
index ea470da..a86eff3 100644
--- a/example/lib/util/localizations_delegate.dart
+++ b/example/lib/util/localizations_delegate.dart
@@ -144,4 +144,12 @@ class _DefaultCupertinoLocalizations extends CupertinoLocalizations {
@override
String get todayLabel => "今天";
+
+ @override
+ // TODO: implement modalBarrierDismissLabel
+ String get modalBarrierDismissLabel => "关闭";
+
+ @override
+ String tabSemanticsLabel({int tabIndex, int tabCount}) {
+ }
}
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index cd34b18..74e6da9 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -38,7 +38,7 @@ dev_dependencies:
zhiying_moments:
#path: ../zhiying_moments
git:
- ref: 0.1.0
+ ref: 0.1.1
url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_moments.git
# For information on the generic Dart part of this file, see the
diff --git a/lib/widgets/share/share_alert.dart b/lib/widgets/share/share_alert.dart
index a78d750..b7ab864 100644
--- a/lib/widgets/share/share_alert.dart
+++ b/lib/widgets/share/share_alert.dart
@@ -6,6 +6,7 @@ import 'dart:ui';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.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';
@@ -17,6 +18,7 @@ import 'package:zhiying_base_widget/widgets/share/models/share_data_model.dart';
import 'package:zhiying_base_widget/widgets/share/models/share_icon_model.dart';
import 'package:zhiying_base_widget/widgets/share/share_alert_content.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
+import 'dart:io';
class ShareAlert extends StatefulWidget {
final String skipIdentifier;
@@ -202,7 +204,16 @@ class _ShareAlertContentState extends State<_ShareAlertContent> {
print(status);
return;
}
-
+ int count = 0;
+ if (widget.model.poster != null) {
+ count++;
+ }
+ count += (widget.model?.image?.length ?? 0);
+ // 多图分享
+ if (count > 1) {
+ _shareMultipleImages(item.type);
+ return;
+ }
if (item.type == 'wx') {
_shareByMob(ShareSDKPlatforms.wechatSession);
} else if (item.type == 'pyq') {
@@ -214,7 +225,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> {
} else if (item.type == 'weibo') {
_shareByMob(ShareSDKPlatforms.sina);
} else if (item.type == 'more_setting') {
- _shareBySystem();
+ _shareBySystem(item.type);
}
},
);
@@ -222,16 +233,8 @@ class _ShareAlertContentState extends State<_ShareAlertContent> {
// mob分享,只能单图分享,多图分享调用系统分享
void _shareByMob(ShareSDKPlatform plateform) async {
- int count = 0;
- if (widget.model.poster != null) {
- count++;
- }
- count += (widget.model?.image?.length ?? 0);
- // 多图分享
- if (count > 1) {
- _shareMultipleImages();
- return;
- }
+
+
Loading.show(context);
Timer(Duration(milliseconds: 2000),(){
@@ -303,7 +306,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> {
}
// 系统分享,只能分享图片或者文字,不能组合分享
- void _shareBySystem() async {
+ void _shareBySystem(String type) async {
int count = 0;
if (widget.model.poster != null) {
count++;
@@ -311,7 +314,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> {
count += (widget.model?.image?.length ?? 0);
// 多图分享
if (count > 1) {
- _shareMultipleImages();
+ _shareMultipleImages(type);
return;
}
@@ -341,7 +344,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> {
try {
// 保存到本地路径
final tempDir = await getTemporaryDirectory();
- final file = await File('${tempDir.path}/image.jpg').create();
+ final file = await File('${tempDir.path}/image.png').create();
file.writeAsBytesSync(widget.model.poster);
path = file.path;
@@ -356,17 +359,20 @@ 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(widget.model.image);
paths.addAll(downPaths);
- ShareExtend.shareMultiple(paths, "image", subject: "");
+ if(Platform.isAndroid&&type=='wx'){
+ MorePictureShare.shareWeixinPics(paths);
+ }else{
+ ShareExtend.shareMultiple(paths, "image", subject: "");
+ }
Loading.dismiss();
}
}
diff --git a/pubspec.yaml b/pubspec.yaml
index cde901d..a4b4163 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -14,7 +14,8 @@ dependencies:
flutter_swiper: ^1.1.6
bloc: ^4.0.0
event_bus: ^1.1.1
- pull_to_refresh: ^1.6.1
+ pull_to_refresh:
+ path: ../../1.22.0_master/flutter_pulltorefresh
flutter_cupertino_date_picker:
path: ../../1.22.0_master/flutter-cupertino-date-picker
image_picker: ^0.6.7+3
@@ -39,6 +40,8 @@ dependencies:
ref: 0.0.1
url: http://192.168.0.138:3000/FnuoOS_Flutter_Components/permission_handler.git
+ more_picture_share:
+ path: ../more_picture_share
intl: 0.16.1