From c475ab285ea78afd09c1dc2289e9492beb2f8f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Thu, 21 Jan 2021 19:11:35 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E6=99=BA=E8=83=BD=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=9A=84=E6=A3=80=E7=B4=A2=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intellect_create.dart | 2 +- .../mine_detail_page/mine_detail_page.dart | 2 +- lib/widgets/share/share_alert.dart | 93 ++++++++----------- 3 files changed, 39 insertions(+), 58 deletions(-) diff --git a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart index 8814c96..c2ad937 100644 --- a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart +++ b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart @@ -130,7 +130,7 @@ class IntellectCreate { } ///长度大小限制 - if (setModel.isKeyLength == "1" && (int.tryParse(setModel.keyLengthMin) > content.length) || (int.tryParse(setModel.keyLengthMax) < content.length)) { + if (setModel.isKeyLength == "1" && ((int.tryParse(setModel.keyLengthMin) > content.length) || (int.tryParse(setModel.keyLengthMax) < content.length))) { return; } diff --git a/lib/pages/mine_detail_page/mine_detail_page.dart b/lib/pages/mine_detail_page/mine_detail_page.dart index 13705f1..7bee974 100644 --- a/lib/pages/mine_detail_page/mine_detail_page.dart +++ b/lib/pages/mine_detail_page/mine_detail_page.dart @@ -336,7 +336,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> { backgroundColor: Colors.transparent); if (index != null) { print(index); - _bloc.updateUser(gender: index == 0 ? '1' : '2'); + _bloc.updateUser(gender: index == 0 ? '0' : '1'); } } diff --git a/lib/widgets/share/share_alert.dart b/lib/widgets/share/share_alert.dart index 505fe6a..5a62205 100644 --- a/lib/widgets/share/share_alert.dart +++ b/lib/widgets/share/share_alert.dart @@ -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 { @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 { Map d = modList.first; if (d != null) { String dString = d['data']; - _iconModel = ShareAlertModel.fromJson( - Map.from(jsonDecode(dString))); + _iconModel = ShareAlertModel.fromJson(Map.from(jsonDecode(dString))); setState(() {}); } @@ -59,30 +55,33 @@ class _ShareAlertState extends State { @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: [ - 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: [ + 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 downPaths = - await ImageDownloadUtil.download(widget.model.image); + List downPaths = await ImageDownloadUtil.download(widget.model.image); paths.addAll(downPaths); ShareExtend.shareMultiple(paths, "image", subject: ""); Loading.dismiss();