|
|
@@ -24,8 +24,7 @@ class GoodsShareLink extends StatefulWidget { |
|
|
|
|
|
|
|
final String shareType; |
|
|
|
|
|
|
|
const GoodsShareLink(this.model, this.params, this.shareType, {Key key}) |
|
|
|
: super(key: key); |
|
|
|
const GoodsShareLink(this.model, this.params, this.shareType, {Key key}) : super(key: key); |
|
|
|
|
|
|
|
@override |
|
|
|
_GoodsShareLinkState createState() => _GoodsShareLinkState(); |
|
|
@@ -36,8 +35,7 @@ class _GoodsShareLinkState extends State<GoodsShareLink> { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return BlocProvider<GoodsShareContentBloc>( |
|
|
|
bloc: GoodsShareContentBloc(), |
|
|
|
child: |
|
|
|
_GoodsShareLinkContent(widget.model, widget.params, widget.shareType), |
|
|
|
child: _GoodsShareLinkContent(widget.model, widget.params, widget.shareType), |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@@ -49,16 +47,13 @@ class _GoodsShareLinkContent extends StatefulWidget { |
|
|
|
|
|
|
|
// final GoodsShareTempDataModel datas; |
|
|
|
|
|
|
|
const _GoodsShareLinkContent(this.model, this.params, this.shareType, |
|
|
|
{Key key}) |
|
|
|
: super(key: key); |
|
|
|
const _GoodsShareLinkContent(this.model, this.params, this.shareType, {Key key}) : super(key: key); |
|
|
|
|
|
|
|
@override |
|
|
|
_GoodsShareLinkContentState createState() => _GoodsShareLinkContentState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
|
with AutomaticKeepAliveClientMixin { |
|
|
|
class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> with AutomaticKeepAliveClientMixin { |
|
|
|
GoodsShareImageModel _style; |
|
|
|
Map<int, String> _images = Map(); |
|
|
|
List<Widget> widgets = List(); |
|
|
@@ -95,6 +90,13 @@ class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
|
if (_content == null || _content == '') { |
|
|
|
_content = data.shareContent; |
|
|
|
} |
|
|
|
|
|
|
|
_shareModel.image = List(); |
|
|
|
|
|
|
|
_shareModel.title = data?.appName ?? ""; |
|
|
|
_shareModel.content=_content; |
|
|
|
// _shareModel.image.add(data?.imgUrl ?? ""); |
|
|
|
|
|
|
|
widgets.add(GoodsShareItem( |
|
|
|
imgHeader: _style?.cssList?.headerImage ?? '', |
|
|
|
imgCheck: _style?.cssList?.unChooseImage ?? '', |
|
|
@@ -125,10 +127,7 @@ class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
|
onEditorClick: () { |
|
|
|
Fluttertoast.showToast(msg: '正在开发中'); |
|
|
|
return; |
|
|
|
Navigator.push( |
|
|
|
context, |
|
|
|
CupertinoPageRoute( |
|
|
|
builder: (context) => GoodsShareEditor(_style))); |
|
|
|
Navigator.push(context, CupertinoPageRoute(builder: (context) => GoodsShareEditor(_style))); |
|
|
|
}, |
|
|
|
onTempChange: (temp) { |
|
|
|
setState(() { |
|
|
@@ -160,34 +159,25 @@ class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
|
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, |
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
children: widgets), |
|
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: widgets), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
_createBottom(), |
|
|
|
_createBottom(data), |
|
|
|
], |
|
|
|
); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
Widget _createBottom() { |
|
|
|
Widget _createBottom(GoodsShareTempDataModel data) { |
|
|
|
Map<String, dynamic> shareImages = _style?.cssList?.shareLink; |
|
|
|
if (shareImages == null) { |
|
|
|
return Container(); |
|
|
|
} |
|
|
|
CustomButtonModel btnCopy = CustomButtonModel.fromJson( |
|
|
|
Map<String, dynamic>.from(shareImages['copy_btn'])); |
|
|
|
CustomButtonModel btnShare = CustomButtonModel.fromJson( |
|
|
|
Map<String, dynamic>.from(shareImages['share_btn'])); |
|
|
|
CustomButtonModel btnCopy = CustomButtonModel.fromJson(Map<String, dynamic>.from(shareImages['copy_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), |
|
|
@@ -202,7 +192,11 @@ class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.circular(18), |
|
|
|
), |
|
|
|
child: CustomButton(btnCopy)), |
|
|
|
child: GestureDetector( |
|
|
|
onTap: () { |
|
|
|
Clipboard.setData(ClipboardData(text: _content)); |
|
|
|
}, |
|
|
|
child: CustomButton(btnCopy))), |
|
|
|
btnShare == null |
|
|
|
? Container() |
|
|
|
: GestureDetector( |
|
|
@@ -225,15 +219,16 @@ class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
|
} |
|
|
|
|
|
|
|
void _showShare() async { |
|
|
|
List<String> images = List(); |
|
|
|
for (int index = 0; index < _style.customImage.length; index++) { |
|
|
|
if (_images.containsKey(index)) { |
|
|
|
images.add(_images[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
if (images.length >= 0) { |
|
|
|
_shareModel.image = images; |
|
|
|
} |
|
|
|
// List<String> images = List(); |
|
|
|
// for (int index = 0; index < _style.customImage.length; index++) { |
|
|
|
// if (_images.containsKey(index)) { |
|
|
|
// images.add(_images[index]); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// if (images.length >= 0) { |
|
|
|
// _shareModel.image = images; |
|
|
|
// } |
|
|
|
|
|
|
|
showCupertinoModalPopup( |
|
|
|
context: context, |
|
|
|
builder: (context) => ShareAlert( |
|
|
|