From 24903d2818d7f327556f7faca354321ddb737b29 Mon Sep 17 00:00:00 2001 From: WinUser01 Date: Tue, 10 May 2022 20:35:24 +0800 Subject: [PATCH] =?UTF-8?q?hyzp=5Fybqx-Commit159=EF=BC=9A=E5=B7=B2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A5=BDtoday=5Flist=5Fzpjl=5Fcontent=5Fnew.?= =?UTF-8?q?dart=E3=80=82=E4=BD=BF=E7=94=A8=E8=87=AA=E5=AE=9A=E4=B9=89=20my?= =?UTF-8?q?=5Fflutter=5Fdrag=5Fscale=20=E6=8F=92=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E5=AE=8C=E7=BE=8E=E8=A7=A3=E5=86=B3Listview=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E4=B8=8E=E5=9B=BE=E7=89=87=E7=BC=A9=E6=94=BE=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E4=B9=8B=E9=97=B4=E7=9A=84=E6=89=8B=E5=8A=BF=E5=86=B2=E7=AA=81?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E4=BC=9A=E6=B6=88=E8=80=97=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=EF=BC=8C=E6=BB=9A=E5=8A=A8=E5=BE=88=E7=81=B5?= =?UTF-8?q?=E6=95=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TJXX/today_list_zpjl_content_new.dart | 109 +++++++++++------- 1 file changed, 66 insertions(+), 43 deletions(-) diff --git a/lib/pages/Works/TJXX/today_list_zpjl_content_new.dart b/lib/pages/Works/TJXX/today_list_zpjl_content_new.dart index c037eea..a3e702a 100644 --- a/lib/pages/Works/TJXX/today_list_zpjl_content_new.dart +++ b/lib/pages/Works/TJXX/today_list_zpjl_content_new.dart @@ -127,26 +127,45 @@ class _TodayListZpjlPageState extends State { double _radioImage = 9 / 16; - // 使用 cached_network_image 插件实现网络图片缓存 - // 使用 flutter_drag_scale 实现可缩放可拖拽双击放大的图片功能。PhotoView插件不好用,有问题 + // 使用自定义 my_flutter_drag_scale 插件,完美解决Listview滚动与图片缩放拖动之间的手势冲突,不会消耗点击事件,滚动很灵敏 + ScrollPhysics scrollPhysics; + bool bZoomedInit = true; // 图片是否为原样大小 Widget getNetworkImage(String url) { return CachedNetworkImage( imageUrl: url, alignment: Alignment.topCenter, - imageBuilder: (context, imageProvider) => DragScaleContainer( - doubleTapStillScale: true, child: Image(image: imageProvider, fit: BoxFit.fill) - // child: Image( - // image: NetworkImage( - // 'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'), - // ), - ), - // imageBuilder: (context, imageProvider) => PhotoView( - // imageProvider: imageProvider, - // ), - //placeholder: (context, url) => CircularProgressIndicator(), placeholder: (context, url) => getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0), errorWidget: (context, url, error) => Icon(Icons.error), + imageBuilder: (context, imageProvider) { + return DragScaleContainer( + doubleTapStillScale: false, + child: Image(image: imageProvider, fit: BoxFit.fill), + scaleChangedCallback: (ScaleChangedModel model) { + print("model.scale = ${model.scale}"); + bZoomedInit = (1.0 == model.scale); + scrollPhysics = PageScrollPhysics(); + setState(() {}); + }, + pointerDownCallback: () { + if (bZoomedInit) { + if (scrollPhysics != PageScrollPhysics()) { + scrollPhysics = PageScrollPhysics(); + setState(() {}); + } + } else { + if (scrollPhysics != NeverScrollableScrollPhysics()) { + scrollPhysics = NeverScrollableScrollPhysics(); + setState(() {}); + } + } + }, + pointerUpCallback: () { + scrollPhysics = PageScrollPhysics(); + setState(() {}); + }, + ); + }, ); } @@ -828,37 +847,41 @@ class _TodayListZpjlPageState extends State { ), ) : SizedBox.shrink(), - KeyboardAvoider( - autoScroll: true, - child: Container( - color: Color.fromRGBO(244, 244, 244, 1), - child: Column( - children: [ - //1、得到格林曼黑度标准和视频播放按钮组件 - getHdAndPlay(), - //2、得到违章图片组件 - imageWztp, - SizedBox(height: ScreenUtil().setHeight(_marginVer)), - //3、得到违章图片说明信息组件 - getWztpSmxx(), - SizedBox(height: ScreenUtil().setHeight(_marginVer)), - //7、得到黑烟初审信息组件 - widget.hyshlx == 'hycs' || - widget.hyshlx == 'hyfh' || - widget.hyshlx == 'tsjj' - ? getHyshInfo('hycsInfo') - : SizedBox.shrink(), - //8、得到黑烟复审信息组件 - widget.hyshlx == 'hyfh' || widget.hyshlx == 'tsjj' - ? getHyshInfo('hyfhInfo') - : SizedBox.shrink(), - SizedBox(height: widget.hyshlx == 'tsjj' ? 0 : 15), - //9、得到推送交警确认组件 - getTsjjQr(), - //SizedBox(height: 10), - ], + ListView( + // physics: NeverScrollableScrollPhysics(), // 允许ListView滚动 + // physics: null, // 允许ListView滚动 + physics: scrollPhysics, + children: [ + Container( + color: Color.fromRGBO(244, 244, 244, 1), + child: Column( + children: [ + //1、得到格林曼黑度标准和视频播放按钮组件 + getHdAndPlay(), + //2、得到违章图片组件 + imageWztp, + SizedBox(height: ScreenUtil().setHeight(_marginVer)), + //3、得到违章图片说明信息组件 + getWztpSmxx(), + SizedBox(height: ScreenUtil().setHeight(_marginVer)), + //7、得到黑烟初审信息组件 + widget.hyshlx == 'hycs' || + widget.hyshlx == 'hyfh' || + widget.hyshlx == 'tsjj' + ? getHyshInfo('hycsInfo') + : SizedBox.shrink(), + //8、得到黑烟复审信息组件 + widget.hyshlx == 'hyfh' || widget.hyshlx == 'tsjj' + ? getHyshInfo('hyfhInfo') + : SizedBox.shrink(), + SizedBox(height: widget.hyshlx == 'tsjj' ? 0 : 15), + //9、得到推送交警确认组件 + getTsjjQr(), + //SizedBox(height: 10), + ], + ), ), - ), + ], ), widget.hyshlx == 'tsjj' ? Positioned(