diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index f8ce131..ed99d49 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -415,6 +415,12 @@
"packageUri": "lib/",
"languageVersion": "2.1"
},
+ {
+ "name": "sharesdk_plugin",
+ "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/sharesdk_plugin-1.2.8",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
{
"name": "shimmer",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/shimmer-1.1.1",
@@ -584,7 +590,7 @@
"languageVersion": "2.1"
}
],
- "generated": "2020-09-28T01:22:36.945080Z",
+ "generated": "2020-09-28T02:48:13.803350Z",
"generator": "pub",
"generatorVersion": "2.7.2"
}
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index fd1c048..b005bc5 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -40,6 +40,54 @@ PODS:
- Flutter
- jdsdk (0.0.1):
- Flutter
+ - mob_sharesdk (4.3.11):
+ - mob_sharesdk/ShareSDK (= 4.3.11)
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDK (4.3.11):
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKExtension (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKPlatforms/Douyin (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKPlatforms/Facebook (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKPlatforms/KuaiShou (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKPlatforms/Line (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKPlatforms/Oasis (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKPlatforms/QQ (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKPlatforms/SinaWeibo (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKPlatforms/SnapChat (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKPlatforms/Twitter (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKPlatforms/WeChat (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKRestoreScene (4.3.11):
+ - mob_sharesdk/ShareSDKExtension
+ - MOBFoundation (>= 3.2.9)
+ - mob_sharesdk/ShareSDKUI (4.3.11):
+ - mob_sharesdk/ShareSDK
+ - MOBFoundation (>= 3.2.9)
+ - MOBFoundation (3.2.19)
- mtopSDK (3.0.0.3-BC)
- package_info (0.0.1):
- Flutter
@@ -65,6 +113,23 @@ PODS:
- Flutter
- shared_preferences_windows (0.0.1):
- Flutter
+ - sharesdk_plugin (1.1.2):
+ - Flutter
+ - mob_sharesdk
+ - mob_sharesdk/ShareSDKExtension
+ - mob_sharesdk/ShareSDKPlatforms/Douyin
+ - mob_sharesdk/ShareSDKPlatforms/Facebook
+ - mob_sharesdk/ShareSDKPlatforms/KuaiShou
+ - mob_sharesdk/ShareSDKPlatforms/Line
+ - mob_sharesdk/ShareSDKPlatforms/Oasis
+ - mob_sharesdk/ShareSDKPlatforms/QQ
+ - mob_sharesdk/ShareSDKPlatforms/SinaWeibo
+ - mob_sharesdk/ShareSDKPlatforms/SnapChat
+ - mob_sharesdk/ShareSDKPlatforms/Twitter
+ - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo
+ - mob_sharesdk/ShareSDKPlatforms/WeChat
+ - mob_sharesdk/ShareSDKRestoreScene
+ - mob_sharesdk/ShareSDKUI
- sqflite (0.0.1):
- Flutter
- FMDB (~> 2.7.2)
@@ -91,6 +156,12 @@ PODS:
- WindVane/WindVane (8.5.0.46-bc11)
- zhiying_base_widget (0.0.1):
- Flutter
+ - mob_sharesdk
+ - mob_sharesdk/ShareSDKExtension
+ - mob_sharesdk/ShareSDKPlatforms/QQ
+ - mob_sharesdk/ShareSDKPlatforms/SinaWeibo
+ - mob_sharesdk/ShareSDKPlatforms/WeChat
+ - mob_sharesdk/ShareSDKUI
- zhiying_comm (0.0.1):
- Flutter
@@ -118,6 +189,7 @@ DEPENDENCIES:
- shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)
- shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)
- shared_preferences_windows (from `.symlinks/plugins/shared_preferences_windows/ios`)
+ - sharesdk_plugin (from `.symlinks/plugins/sharesdk_plugin/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`)
@@ -139,6 +211,8 @@ SPEC REPOS:
- UTDID
- WindVane
https://github.com/CocoaPods/Specs.git:
+ - mob_sharesdk
+ - MOBFoundation
- Reachability
trunk:
- FMDB
@@ -191,6 +265,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_web/ios"
shared_preferences_windows:
:path: ".symlinks/plugins/shared_preferences_windows/ios"
+ sharesdk_plugin:
+ :path: ".symlinks/plugins/sharesdk_plugin/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher:
@@ -228,6 +304,8 @@ SPEC CHECKSUMS:
image_cropper: 3c16d7651730ffe85897f5a1c4e2547e6b54989a
image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09
jdsdk: 2ca38c7e3a2dfb0f3641425f8fd1e8d20357693f
+ mob_sharesdk: e0d8b5807e6063cac8f9d68ef059b1d3006c9088
+ MOBFoundation: 606bc4c10ff4c6ac573c09f5081a39c75316bc7b
mtopSDK: d6fdf81730342a69be920b576541c7bb81a683d5
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
@@ -242,6 +320,7 @@ SPEC CHECKSUMS:
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9
shared_preferences_windows: 36b76d6f54e76ead957e60b49e2f124b4cd3e6ae
+ sharesdk_plugin: de8d8b87c50d60017472c5da425db1acd2911e0a
sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0
TOCropViewController: 20a14b6a7a098308bf369e7c8d700dc983a974e6
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
@@ -252,7 +331,7 @@ SPEC CHECKSUMS:
UTDID: c28855683c5ea2e77e597cb14609328f7d470d6e
webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96
WindVane: 56e096abae757397ccd3accb66a959f3ffcbf949
- zhiying_base_widget: 00868c0d2723a3a425c18b27204fbc67e3f7e59d
+ zhiying_base_widget: 064547d1dfe4a5832487f275cd4775d6da8f260c
zhiying_comm: 0daef4a480f4f4dbea3e11b615f3264aafea924b
PODFILE CHECKSUM: 1a8daf665c989cd04294c52f08548c3a236358d1
diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist
index 9945d13..e57a9c2 100644
--- a/example/ios/Runner/Info.plist
+++ b/example/ios/Runner/Info.plist
@@ -10,6 +10,12 @@
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
+
+ MOBAppKey
+ 30dc33054b635
+ MOBAppSecret
+ 396e98c293130c9976fb7428b6b434d6
+
CFBundleName
zhiying_base_widget_example
CFBundlePackageType
diff --git a/ios/zhiying_base_widget.podspec b/ios/zhiying_base_widget.podspec
index 8be071e..8b5e9d9 100644
--- a/ios/zhiying_base_widget.podspec
+++ b/ios/zhiying_base_widget.podspec
@@ -16,6 +16,13 @@ A new Flutter plugin.
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
+ s.dependency 'mob_sharesdk'
+ s.dependency 'mob_sharesdk/ShareSDKExtension'
+ s.dependency 'mob_sharesdk/ShareSDKUI'
+ s.dependency 'mob_sharesdk/ShareSDKPlatforms/QQ'
+ s.dependency 'mob_sharesdk/ShareSDKPlatforms/SinaWeibo'
+ s.dependency 'mob_sharesdk/ShareSDKPlatforms/WeChat'
+
s.platform = :ios, '8.0'
# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
diff --git a/lib/pages/goods_share_page/goods_share_page.dart b/lib/pages/goods_share_page/goods_share_page.dart
index c07a421..87a2743 100644
--- a/lib/pages/goods_share_page/goods_share_page.dart
+++ b/lib/pages/goods_share_page/goods_share_page.dart
@@ -4,6 +4,7 @@ import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_image/goo
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_link/goods_share_link.dart';
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_miniprogram/goods_share_miniprogram.dart';
import 'package:zhiying_base_widget/pages/goods_share_page/widgets/goods_share_alert_content.dart';
+import 'package:zhiying_base_widget/widgets/share/models/share_data_model.dart';
import 'package:zhiying_base_widget/widgets/share/share_alert.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
@@ -224,6 +225,12 @@ class _GoodsSharePageState extends State
showCupertinoModalPopup(
context: context,
builder: (context) => ShareAlert(
+ ShareDataModel(
+ title: 'title',
+ content: 'content',
+ image:
+ 'https://img.alicdn.com/bao/uploaded/i1/2200818126974/O1CN01HvqWcg21O8mq9EPwf_!!0-item_pic.jpg_250x250.jpg',
+ url: 'http://www.hairuyi.com'),
child: GoodsShareAlertContent(),
),
);
diff --git a/lib/register.dart b/lib/register.dart
index 15f5de4..31f58a2 100644
--- a/lib/register.dart
+++ b/lib/register.dart
@@ -1,3 +1,4 @@
+import 'package:sharesdk_plugin/sharesdk_plugin.dart';
import 'package:zhiying_base_widget/pages/favorite_page/favorite_page.dart';
import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page.dart';
import 'package:zhiying_base_widget/pages/invited_friends/invited_friends.dart';
@@ -61,6 +62,16 @@ class BaseWidgetRegister {
throw Future.error('BaseSettingModel 初始化失败');
}
});
+
+ Application.addMethod(() async {
+ ShareSDKRegister register = ShareSDKRegister();
+ register.setupWechat("wx617c77c82218ea2c",
+ "c7253e5289986cf4c4c74d1ccc185fb1", "https://www.sandslee.com/");
+ register.setupSinaWeibo("568898243", "38a4f8204cc784f81f9f0daaf31e02e3",
+ "http://www.sharesdk.cn");
+ register.setupQQ("1111030588", "XoHKlrBybXy7ORBt");
+ SharesdkPlugin.regist(register);
+ });
}
// 注册页面
diff --git a/lib/widgets/share/models/share_data_model.dart b/lib/widgets/share/models/share_data_model.dart
new file mode 100644
index 0000000..035055b
--- /dev/null
+++ b/lib/widgets/share/models/share_data_model.dart
@@ -0,0 +1,13 @@
+class ShareDataModel {
+ String title;
+ String content;
+ dynamic image;
+ String url;
+
+ ShareDataModel({
+ this.title,
+ this.content,
+ this.image,
+ this.url,
+ });
+}
diff --git a/lib/widgets/share/models/share_plateform.dart b/lib/widgets/share/models/share_plateform.dart
new file mode 100644
index 0000000..a5cefec
--- /dev/null
+++ b/lib/widgets/share/models/share_plateform.dart
@@ -0,0 +1,7 @@
+enum SharePlateform {
+ wechatSession, // 微信好友
+ wechatTimeline, // 微信朋友圈
+ qq, // qq好友
+ qqZone, // qq空间
+ sina, // 新浪微博
+}
diff --git a/lib/widgets/share/share_alert.dart b/lib/widgets/share/share_alert.dart
index 00fe308..d671c50 100644
--- a/lib/widgets/share/share_alert.dart
+++ b/lib/widgets/share/share_alert.dart
@@ -1,11 +1,16 @@
import 'dart:ui';
import 'package:flutter/material.dart';
+import 'package:sharesdk_plugin/sharesdk_plugin.dart';
+import 'package:zhiying_base_widget/widgets/share/models/share_data_model.dart';
+import 'package:zhiying_base_widget/widgets/share/models/share_plateform.dart';
+import 'package:zhiying_comm/zhiying_comm.dart';
class ShareAlert extends StatelessWidget {
final Widget child;
+ final ShareDataModel model;
- const ShareAlert({Key key, this.child}) : super(key: key); // 中间视图
+ const ShareAlert(this.model, {Key key, this.child}) : super(key: key); // 中间视图
@override
Widget build(BuildContext context) {
@@ -20,7 +25,7 @@ class ShareAlert extends StatelessWidget {
Expanded(
child: Center(child: child ?? Container()),
),
- _ShareAlertContent(),
+ _ShareAlertContent(this.model),
],
),
), // 模糊化
@@ -34,6 +39,10 @@ class ShareAlert extends StatelessWidget {
}
class _ShareAlertContent extends StatelessWidget {
+ final ShareDataModel model;
+
+ const _ShareAlertContent(this.model, {Key key}) : super(key: key);
+
@override
Widget build(BuildContext context) {
return GestureDetector(
@@ -110,29 +119,75 @@ class _ShareAlertContent extends StatelessWidget {
}
Widget _createIcon() {
- return Container(
- width: 60,
- child: Column(
- children: [
- Container(
- width: 40,
- height: 40,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(20),
- color: Colors.redAccent),
- ),
- Padding(
- padding: const EdgeInsets.only(top: 2, bottom: 2),
- child: Text(
- '分享平台',
- style: TextStyle(
- fontSize: 12,
- color: Color(0xff333333),
- fontWeight: FontWeight.bold),
+ return GestureDetector(
+ child: Container(
+ width: 60,
+ child: Column(
+ children: [
+ Container(
+ width: 40,
+ height: 40,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(20),
+ color: Colors.redAccent),
),
- ),
- ],
+ Padding(
+ padding: const EdgeInsets.only(top: 2, bottom: 2),
+ child: Text(
+ '分享平台',
+ style: TextStyle(
+ fontSize: 12,
+ color: Color(0xff333333),
+ fontWeight: FontWeight.bold),
+ ),
+ ),
+ ],
+ ),
),
+ onTap: () {
+ _shareByMob(SharePlateform.qq);
+ },
);
}
+
+ void _shareByMob(SharePlateform plateform) {
+ //单独公共分享
+ SSDKMap params = SSDKMap()
+ ..setGeneral(
+ model.title,
+ model.content,
+ model.image,
+ null,
+ null,
+ model.url,
+ null,
+ null,
+ null,
+ null,
+ SSDKContentTypes.audio,
+ );
+ ShareSDKPlatform p = ShareSDKPlatforms.wechatSession;
+ switch (plateform) {
+ case SharePlateform.wechatSession:
+ p = ShareSDKPlatforms.wechatSession;
+ break;
+ case SharePlateform.wechatTimeline:
+ p = ShareSDKPlatforms.wechatTimeline;
+ break;
+ case SharePlateform.qq:
+ p = ShareSDKPlatforms.qq;
+ break;
+ case SharePlateform.qqZone:
+ p = ShareSDKPlatforms.qZone;
+ break;
+ case SharePlateform.sina:
+ p = ShareSDKPlatforms.sina;
+ break;
+ }
+
+ SharesdkPlugin.share(p, params, (SSDKResponseState state, Map userdata,
+ Map contentEntity, SSDKError error) {
+ Logger.debug('${state}, ${error.rawData}');
+ });
+ }
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 0f99385..a245a4e 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -24,6 +24,8 @@ dependencies:
git:
url: 'http://192.168.0.138:3000/FnuoOS_Flutter_Components/Image_Cropper.git'
ref: '1.2.3+1'
+ # mob 分享sdk
+ sharesdk_plugin: ^1.2.8
dev_dependencies:
flutter_test: