|
|
@@ -22,9 +22,7 @@ class ShareAlert extends StatefulWidget { |
|
|
|
final bool isContentShow; |
|
|
|
final ShareDataModel model; |
|
|
|
|
|
|
|
const ShareAlert(this.model, this.skipIdentifier, |
|
|
|
{Key key, this.isContentShow = false}) |
|
|
|
: super(key: key); // 中间视图 |
|
|
|
const ShareAlert(this.model, this.skipIdentifier, {Key key, this.isContentShow = false}) : super(key: key); // 中间视图 |
|
|
|
|
|
|
|
@override |
|
|
|
_ShareAlertState createState() => _ShareAlertState(); |
|
|
@@ -35,8 +33,7 @@ class _ShareAlertState extends State<ShareAlert> { |
|
|
|
|
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
NetUtil.request('/api/v1/mod/${widget.skipIdentifier}', |
|
|
|
method: NetMethod.GET, onCache: (data) { |
|
|
|
NetUtil.request('/api/v1/mod/${widget.skipIdentifier}', method: NetMethod.GET, onCache: (data) { |
|
|
|
_parseData(data); |
|
|
|
}, onSuccess: (data) { |
|
|
|
_parseData(data); |
|
|
@@ -50,8 +47,7 @@ class _ShareAlertState extends State<ShareAlert> { |
|
|
|
Map d = modList.first; |
|
|
|
if (d != null) { |
|
|
|
String dString = d['data']; |
|
|
|
_iconModel = ShareAlertModel.fromJson( |
|
|
|
Map<String, dynamic>.from(jsonDecode(dString))); |
|
|
|
_iconModel = ShareAlertModel.fromJson(Map<String, dynamic>.from(jsonDecode(dString))); |
|
|
|
|
|
|
|
setState(() {}); |
|
|
|
} |
|
|
@@ -59,30 +55,33 @@ class _ShareAlertState extends State<ShareAlert> { |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return GestureDetector( |
|
|
|
child: Scaffold( |
|
|
|
backgroundColor: Colors.transparent, |
|
|
|
body: BackdropFilter( |
|
|
|
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), //背景 |
|
|
|
child: Container( |
|
|
|
child: Column( |
|
|
|
children: <Widget>[ |
|
|
|
Expanded( |
|
|
|
child: Center( |
|
|
|
child: widget.isContentShow |
|
|
|
? ShareAlertContent(_iconModel) |
|
|
|
: Container()), |
|
|
|
), |
|
|
|
_ShareAlertContent( |
|
|
|
widget.model, widget.skipIdentifier, _iconModel), |
|
|
|
], |
|
|
|
), |
|
|
|
), // 模糊化 |
|
|
|
return WillPopScope( |
|
|
|
onWillPop: () async { |
|
|
|
Loading.dismiss(); |
|
|
|
Navigator.canPop(context); |
|
|
|
return true; |
|
|
|
}, |
|
|
|
child: GestureDetector( |
|
|
|
child: Scaffold( |
|
|
|
backgroundColor: Colors.transparent, |
|
|
|
body: BackdropFilter( |
|
|
|
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), //背景 |
|
|
|
child: Container( |
|
|
|
child: Column( |
|
|
|
children: <Widget>[ |
|
|
|
Expanded( |
|
|
|
child: Center(child: widget.isContentShow ? ShareAlertContent(_iconModel) : Container()), |
|
|
|
), |
|
|
|
_ShareAlertContent(widget.model, widget.skipIdentifier, _iconModel), |
|
|
|
], |
|
|
|
), |
|
|
|
), // 模糊化 |
|
|
|
), |
|
|
|
), |
|
|
|
onTap: () { |
|
|
|
Navigator.of(context).pop(); |
|
|
|
}, |
|
|
|
), |
|
|
|
onTap: () { |
|
|
|
Navigator.of(context).pop(); |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@@ -92,9 +91,7 @@ class _ShareAlertContent extends StatefulWidget { |
|
|
|
final String skipIdentifier; |
|
|
|
final ShareAlertModel iconModel; |
|
|
|
|
|
|
|
const _ShareAlertContent(this.model, this.skipIdentifier, this.iconModel, |
|
|
|
{Key key}) |
|
|
|
: super(key: key); |
|
|
|
const _ShareAlertContent(this.model, this.skipIdentifier, this.iconModel, {Key key}) : super(key: key); |
|
|
|
|
|
|
|
@override |
|
|
|
_ShareAlertContentState createState() => _ShareAlertContentState(); |
|
|
@@ -122,36 +119,25 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { |
|
|
|
margin: EdgeInsets.only(top: 8, bottom: 8), |
|
|
|
width: 62, |
|
|
|
height: 4, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Color(0xffd8d8d8), |
|
|
|
borderRadius: BorderRadius.circular(2)), |
|
|
|
decoration: BoxDecoration(color: Color(0xffd8d8d8), borderRadius: BorderRadius.circular(2)), |
|
|
|
), |
|
|
|
Text( |
|
|
|
'分享至', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 15, |
|
|
|
color: Color(0xff333333), |
|
|
|
fontWeight: FontWeight.bold), |
|
|
|
style: TextStyle(fontSize: 15, color: Color(0xff333333), fontWeight: FontWeight.bold), |
|
|
|
), |
|
|
|
Container( |
|
|
|
margin: |
|
|
|
EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), |
|
|
|
margin: EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), |
|
|
|
child: _createIcons(), |
|
|
|
), |
|
|
|
GestureDetector( |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.only(left: 12, right: 12, bottom: 10), |
|
|
|
padding: EdgeInsets.all(12), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Color(0xfff3f3f3), |
|
|
|
borderRadius: BorderRadius.circular(8)), |
|
|
|
decoration: BoxDecoration(color: Color(0xfff3f3f3), borderRadius: BorderRadius.circular(8)), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
'取消', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12, |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
color: Color(0xff999999)), |
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold, color: Color(0xff999999)), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@@ -195,10 +181,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { |
|
|
|
padding: const EdgeInsets.only(top: 2, bottom: 2), |
|
|
|
child: Text( |
|
|
|
item.name, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12, |
|
|
|
color: Color(0xff333333), |
|
|
|
fontWeight: FontWeight.bold), |
|
|
|
style: TextStyle(fontSize: 12, color: Color(0xff333333), fontWeight: FontWeight.bold), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
@@ -279,8 +262,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { |
|
|
|
SSDKContentTypes.auto, |
|
|
|
); |
|
|
|
} |
|
|
|
SharesdkPlugin.share(plateform, params, (SSDKResponseState state, |
|
|
|
Map userdata, Map contentEntity, SSDKError error) { |
|
|
|
SharesdkPlugin.share(plateform, params, (SSDKResponseState state, Map userdata, Map contentEntity, SSDKError error) { |
|
|
|
if (state == SSDKResponseState.Fail) { |
|
|
|
Fluttertoast.showToast(msg: '分享失败'); |
|
|
|
} else if (state == SSDKResponseState.Success) { |
|
|
@@ -355,8 +337,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { |
|
|
|
} |
|
|
|
|
|
|
|
Loading.show(context); |
|
|
|
List<String> downPaths = |
|
|
|
await ImageDownloadUtil.download(widget.model.image); |
|
|
|
List<String> downPaths = await ImageDownloadUtil.download(widget.model.image); |
|
|
|
paths.addAll(downPaths); |
|
|
|
ShareExtend.shareMultiple(paths, "image", subject: ""); |
|
|
|
Loading.dismiss(); |
|
|
|