|
|
@@ -10,6 +10,8 @@ import 'package:zhiying_base_widget/widgets/public/custom_button/custom_bottom.d |
|
|
|
import 'package:zhiying_base_widget/widgets/public/custom_button/custom_button_model.dart'; |
|
|
|
import 'package:zhiying_comm/util/base_bloc.dart'; |
|
|
|
import 'package:zhiying_comm/zhiying_comm.dart'; |
|
|
|
import 'package:sharesdk_plugin/sharesdk_plugin.dart'; |
|
|
|
import 'package:fluwx/fluwx.dart'; |
|
|
|
|
|
|
|
class GoodsShareMiniprogram extends StatefulWidget { |
|
|
|
final Map<String, dynamic> model; |
|
|
@@ -17,9 +19,7 @@ class GoodsShareMiniprogram extends StatefulWidget { |
|
|
|
|
|
|
|
final String shareType; |
|
|
|
|
|
|
|
const GoodsShareMiniprogram(this.model, this.params, this.shareType, |
|
|
|
{Key key}) |
|
|
|
: super(key: key); |
|
|
|
const GoodsShareMiniprogram(this.model, this.params, this.shareType, {Key key}) : super(key: key); |
|
|
|
|
|
|
|
@override |
|
|
|
_GoodsShareMiniprogramState createState() => _GoodsShareMiniprogramState(); |
|
|
@@ -30,8 +30,7 @@ class _GoodsShareMiniprogramState extends State<GoodsShareMiniprogram> { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return BlocProvider<GoodsShareContentBloc>( |
|
|
|
bloc: GoodsShareContentBloc(), |
|
|
|
child: _GoodsShareMiniprogramContent( |
|
|
|
widget.model, widget.params, widget.shareType), |
|
|
|
child: _GoodsShareMiniprogramContent(widget.model, widget.params, widget.shareType), |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@@ -41,18 +40,13 @@ class _GoodsShareMiniprogramContent extends StatefulWidget { |
|
|
|
final Map<String, dynamic> params; |
|
|
|
final String shareType; |
|
|
|
|
|
|
|
const _GoodsShareMiniprogramContent(this.model, this.params, this.shareType, |
|
|
|
{Key key}) |
|
|
|
: super(key: key); |
|
|
|
const _GoodsShareMiniprogramContent(this.model, this.params, this.shareType, {Key key}) : super(key: key); |
|
|
|
|
|
|
|
@override |
|
|
|
_GoodsShareMiniprogramContentState createState() => |
|
|
|
_GoodsShareMiniprogramContentState(); |
|
|
|
_GoodsShareMiniprogramContentState createState() => _GoodsShareMiniprogramContentState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _GoodsShareMiniprogramContentState |
|
|
|
extends State<_GoodsShareMiniprogramContent> |
|
|
|
with AutomaticKeepAliveClientMixin { |
|
|
|
class _GoodsShareMiniprogramContentState extends State<_GoodsShareMiniprogramContent> with AutomaticKeepAliveClientMixin { |
|
|
|
GoodsShareImageModel _style; |
|
|
|
Map<int, String> _images = Map(); |
|
|
|
List<Widget> widgets = List(); |
|
|
@@ -86,11 +80,7 @@ class _GoodsShareMiniprogramContentState |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.only(bottom: 4), |
|
|
|
padding: EdgeInsets.only(top: 10), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.white, |
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
bottomLeft: Radius.circular(8), |
|
|
|
bottomRight: Radius.circular(8))), |
|
|
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.only(bottomLeft: Radius.circular(8), bottomRight: Radius.circular(8))), |
|
|
|
child: SingleChildScrollView( |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
@@ -127,8 +117,7 @@ class _GoodsShareMiniprogramContentState |
|
|
|
} |
|
|
|
// CustomButtonModel btnCopy = CustomButtonModel.fromJson( |
|
|
|
// Map<String, dynamic>.from(shareImages['copy_btn'])); |
|
|
|
CustomButtonModel btnShare = CustomButtonModel.fromJson( |
|
|
|
Map<String, dynamic>.from(shareImages['share_btn'])); |
|
|
|
CustomButtonModel btnShare = CustomButtonModel.fromJson(Map<String, dynamic>.from(shareImages['share_btn'])); |
|
|
|
return SafeArea( |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4), |
|
|
@@ -147,8 +136,8 @@ class _GoodsShareMiniprogramContentState |
|
|
|
), |
|
|
|
child: CustomButton(btnShare)), |
|
|
|
onTap: () { |
|
|
|
print(data); |
|
|
|
LauncherWxMiniProgram.open(data.toJson()); |
|
|
|
print(data.toJson()); |
|
|
|
_shareMini(data); |
|
|
|
}, |
|
|
|
), |
|
|
|
], |
|
|
@@ -156,4 +145,17 @@ class _GoodsShareMiniprogramContentState |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
void _shareMini(GoodsShareTempDataModel data) { |
|
|
|
WeChatShareMiniProgramModel shareMiniProgramModel = WeChatShareMiniProgramModel( |
|
|
|
miniProgramType: WXMiniProgramType.RELEASE, |
|
|
|
userName: data?.userName, |
|
|
|
webPageUrl: data?.page, |
|
|
|
path: data?.page, |
|
|
|
title: data?.miniAppTitle, |
|
|
|
thumbnail: WeChatImage.network(data?.imageUrl)); |
|
|
|
|
|
|
|
shareToWeChat(shareMiniProgramModel); |
|
|
|
|
|
|
|
} |
|
|
|
} |