|
@@ -24,8 +24,7 @@ class GoodsShareLink extends StatefulWidget { |
|
|
|
|
|
|
|
|
final String shareType; |
|
|
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 |
|
|
@override |
|
|
_GoodsShareLinkState createState() => _GoodsShareLinkState(); |
|
|
_GoodsShareLinkState createState() => _GoodsShareLinkState(); |
|
@@ -36,8 +35,7 @@ class _GoodsShareLinkState extends State<GoodsShareLink> { |
|
|
Widget build(BuildContext context) { |
|
|
Widget build(BuildContext context) { |
|
|
return BlocProvider<GoodsShareContentBloc>( |
|
|
return BlocProvider<GoodsShareContentBloc>( |
|
|
bloc: 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; |
|
|
// 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 |
|
|
@override |
|
|
_GoodsShareLinkContentState createState() => _GoodsShareLinkContentState(); |
|
|
_GoodsShareLinkContentState createState() => _GoodsShareLinkContentState(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
|
|
|
with AutomaticKeepAliveClientMixin { |
|
|
|
|
|
|
|
|
class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> with AutomaticKeepAliveClientMixin { |
|
|
GoodsShareImageModel _style; |
|
|
GoodsShareImageModel _style; |
|
|
Map<int, String> _images = Map(); |
|
|
Map<int, String> _images = Map(); |
|
|
List<Widget> widgets = List(); |
|
|
List<Widget> widgets = List(); |
|
@@ -95,6 +90,13 @@ class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
if (_content == null || _content == '') { |
|
|
if (_content == null || _content == '') { |
|
|
_content = data.shareContent; |
|
|
_content = data.shareContent; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_shareModel.image = List(); |
|
|
|
|
|
|
|
|
|
|
|
_shareModel.title = data?.appName ?? ""; |
|
|
|
|
|
_shareModel.content=_content; |
|
|
|
|
|
// _shareModel.image.add(data?.imgUrl ?? ""); |
|
|
|
|
|
|
|
|
widgets.add(GoodsShareItem( |
|
|
widgets.add(GoodsShareItem( |
|
|
imgHeader: _style?.cssList?.headerImage ?? '', |
|
|
imgHeader: _style?.cssList?.headerImage ?? '', |
|
|
imgCheck: _style?.cssList?.unChooseImage ?? '', |
|
|
imgCheck: _style?.cssList?.unChooseImage ?? '', |
|
@@ -125,10 +127,7 @@ class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
onEditorClick: () { |
|
|
onEditorClick: () { |
|
|
Fluttertoast.showToast(msg: '正在开发中'); |
|
|
Fluttertoast.showToast(msg: '正在开发中'); |
|
|
return; |
|
|
return; |
|
|
Navigator.push( |
|
|
|
|
|
context, |
|
|
|
|
|
CupertinoPageRoute( |
|
|
|
|
|
builder: (context) => GoodsShareEditor(_style))); |
|
|
|
|
|
|
|
|
Navigator.push(context, CupertinoPageRoute(builder: (context) => GoodsShareEditor(_style))); |
|
|
}, |
|
|
}, |
|
|
onTempChange: (temp) { |
|
|
onTempChange: (temp) { |
|
|
setState(() { |
|
|
setState(() { |
|
@@ -160,34 +159,25 @@ class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
child: Container( |
|
|
child: Container( |
|
|
margin: EdgeInsets.only(bottom: 4), |
|
|
margin: EdgeInsets.only(bottom: 4), |
|
|
padding: EdgeInsets.only(top: 10), |
|
|
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: 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; |
|
|
Map<String, dynamic> shareImages = _style?.cssList?.shareLink; |
|
|
if (shareImages == null) { |
|
|
if (shareImages == null) { |
|
|
return Container(); |
|
|
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( |
|
|
return SafeArea( |
|
|
child: Container( |
|
|
child: Container( |
|
|
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4), |
|
|
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4), |
|
@@ -202,7 +192,11 @@ class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
borderRadius: BorderRadius.circular(18), |
|
|
borderRadius: BorderRadius.circular(18), |
|
|
), |
|
|
), |
|
|
child: CustomButton(btnCopy)), |
|
|
|
|
|
|
|
|
child: GestureDetector( |
|
|
|
|
|
onTap: () { |
|
|
|
|
|
Clipboard.setData(ClipboardData(text: _content)); |
|
|
|
|
|
}, |
|
|
|
|
|
child: CustomButton(btnCopy))), |
|
|
btnShare == null |
|
|
btnShare == null |
|
|
? Container() |
|
|
? Container() |
|
|
: GestureDetector( |
|
|
: GestureDetector( |
|
@@ -225,15 +219,16 @@ class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void _showShare() async { |
|
|
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( |
|
|
showCupertinoModalPopup( |
|
|
context: context, |
|
|
context: context, |
|
|
builder: (context) => ShareAlert( |
|
|
builder: (context) => ShareAlert( |
|
|