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(