From 8150e6e51737e07a25d046be9b6e0593886d653e Mon Sep 17 00:00:00 2001 From: WinUser01 Date: Wed, 25 May 2022 23:13:28 +0800 Subject: [PATCH] =?UTF-8?q?hyzp=5Fybqx-Commit166=EF=BC=9A=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=9C=A8=E5=AE=A1=E6=A0=B8=E9=A1=B5=E9=9D=A2hysh=5Fco?= =?UTF-8?q?ntent=5Fnew.dart=EF=BC=8C=E5=BD=93=E5=9B=BE=E7=89=87=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=BC=A9=E6=94=BE=E5=90=8E=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E8=BE=93=E5=85=A5=E6=A1=86=E8=BD=AF=E9=94=AE?= =?UTF-8?q?=E7=9B=98=E5=BC=B9=E8=B5=B7=E9=81=AE=E6=8C=A1=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E7=BB=84=E4=BB=B6=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit // 若 scrollPhysics0 赋值为 PageScrollPhysics(),图片组件缩放后,点击文本输入框软键盘弹起会遮挡文本输入框组件 // 将 scrollPhysics0 赋值为 AlwaysScrollableScrollPhysics(),问题解决 ScrollPhysics scrollPhysics0 = AlwaysScrollableScrollPhysics(); --- lib/pages/Works/HYSH/hysh_content_new.dart | 142 +++++++++++---------- 1 file changed, 76 insertions(+), 66 deletions(-) diff --git a/lib/pages/Works/HYSH/hysh_content_new.dart b/lib/pages/Works/HYSH/hysh_content_new.dart index be89348..a9a1bc2 100644 --- a/lib/pages/Works/HYSH/hysh_content_new.dart +++ b/lib/pages/Works/HYSH/hysh_content_new.dart @@ -596,6 +596,11 @@ class _HyshPageState extends State with SingleTickerProviderStat // 使用自定义 my_flutter_drag_scale 插件,完美解决Listview滚动与图片缩放拖动之间的手势冲突,不会消耗点击事件,滚动很灵敏 ScrollPhysics scrollPhysics; + + // 若 scrollPhysics0 赋值为 PageScrollPhysics(),图片组件缩放后,点击文本输入框软键盘弹起会遮挡文本输入框组件 + // 将 scrollPhysics0 赋值为 AlwaysScrollableScrollPhysics(),问题解决 + ScrollPhysics scrollPhysics0 = AlwaysScrollableScrollPhysics(); + bool bZoomedInit = true; // 图片是否为原样大小 Widget getNetworkImage(String url) { return CachedNetworkImage( @@ -611,13 +616,13 @@ class _HyshPageState extends State with SingleTickerProviderStat scaleChangedCallback: (ScaleChangedModel model) { print("model.scale = ${model.scale}"); bZoomedInit = (1.0 == model.scale); - scrollPhysics = PageScrollPhysics(); + scrollPhysics = scrollPhysics0; setState(() {}); }, pointerDownCallback: () { if (bZoomedInit) { if (scrollPhysics != PageScrollPhysics()) { - scrollPhysics = PageScrollPhysics(); + scrollPhysics = scrollPhysics0; setState(() {}); } } else { @@ -628,7 +633,7 @@ class _HyshPageState extends State with SingleTickerProviderStat } }, pointerUpCallback: () { - scrollPhysics = PageScrollPhysics(); + scrollPhysics = scrollPhysics0; setState(() {}); }, ); @@ -924,70 +929,75 @@ class _HyshPageState extends State with SingleTickerProviderStat ), //: Container(), //type 'Container' is not a subtype of type 'PreferredSizeWidget' - body: listGetZpjl.isNotEmpty - ? TabBarView( - controller: _tabController, - //注意:用TabController实现顶部tab切换,必须添加该行 - physics: NeverScrollableScrollPhysics(), - //必须放到TabBarView下面,禁止TabBarView左右滑动-OK - // children: - // (topTabs_map['listView_List'].isNotEmpty) ? topTabs_map['listView_List'] : [], - - // https://blog.csdn.net/shulianghan/article/details/104953053 - // 集合的生成函数 - // int length 参数 : 集合的长度 - // E generator(int index) : 集合的回调函数 , 调用该函数获取集合的 index 位置的元素 - // List list_generate = List.generate(3, ( index ) => index * 3); - // children: List.generate(3, (index) => Container()), - children: List.generate(topTabs_map['listView_List'].length, (index) { - return ListView( - // physics: NeverScrollableScrollPhysics(), // 允许ListView滚动 - // physics: null, // 允许ListView滚动 - physics: scrollPhysics, - children: [ - Container( - decoration: new BoxDecoration( - color: Color.fromRGBO(244, 244, 244, 1), - ), - child: Column( - children: [ - //1、得到格林曼黑度标准和视频播放按钮组件 - getHdAndPlay(index), - //2、得到违章图片组件 - getWztp(index), - SizedBox(height: ScreenUtil().setHeight(_marginVer)), - //3、得到违章图片说明信息组件 - getWztpSmxx(index), - SizedBox(height: ScreenUtil().setHeight(_marginVer)), - //4、得到黑烟初审结果组件,在复审页面需要 - widget.hyshlx == 'hyfh' ? getHycsResult(index) : SizedBox.shrink(), - //为了用户在切换审核结果Radio时显示不同图片,必须将以下组件都移入到RadioListItems类中 - //5-6、得到黑烟审核组件、审核确认组件 - HyshGroup( - index: index, - hyshlx: hyshlx, - fontSize: _fontSize, - size: Size(_listTileHeight, _listTileHeight), - id: widget.id, - selectedRadio: - hyshlx == 'hyfh' && mapGetHycsShenheData['title'] == "非黑烟车" - ? 1 - : 0, - ), - //为了用户在切换审核结果Radio时显示不同图片,必须将以下组件都移入到RadioListItems类中 - // SizedBox(height: 6), - // Divider(height: 1.0, color: Colors.blue), - // SizedBox(height: 10), - // //9、得到审核确认组件 - // getShqr(index), - ], + body: GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: listGetZpjl.isNotEmpty + ? TabBarView( + controller: _tabController, + //注意:用TabController实现顶部tab切换,必须添加该行 + physics: NeverScrollableScrollPhysics(), + //必须放到TabBarView下面,禁止TabBarView左右滑动-OK + // children: + // (topTabs_map['listView_List'].isNotEmpty) ? topTabs_map['listView_List'] : [], + + // https://blog.csdn.net/shulianghan/article/details/104953053 + // 集合的生成函数 + // int length 参数 : 集合的长度 + // E generator(int index) : 集合的回调函数 , 调用该函数获取集合的 index 位置的元素 + // List list_generate = List.generate(3, ( index ) => index * 3); + // children: List.generate(3, (index) => Container()), + children: List.generate(topTabs_map['listView_List'].length, (index) { + return ListView( + // physics: NeverScrollableScrollPhysics(), // 允许ListView滚动 + // physics: null, // 允许ListView滚动 + physics: scrollPhysics, + children: [ + Container( + decoration: new BoxDecoration( + color: Color.fromRGBO(244, 244, 244, 1), + ), + child: Column( + children: [ + //1、得到格林曼黑度标准和视频播放按钮组件 + getHdAndPlay(index), + //2、得到违章图片组件 + getWztp(index), + SizedBox(height: ScreenUtil().setHeight(_marginVer)), + //3、得到违章图片说明信息组件 + getWztpSmxx(index), + SizedBox(height: ScreenUtil().setHeight(_marginVer)), + //4、得到黑烟初审结果组件,在复审页面需要 + widget.hyshlx == 'hyfh' ? getHycsResult(index) : SizedBox.shrink(), + //为了用户在切换审核结果Radio时显示不同图片,必须将以下组件都移入到RadioListItems类中 + //5-6、得到黑烟审核组件、审核确认组件 + HyshGroup( + index: index, + hyshlx: hyshlx, + fontSize: _fontSize, + size: Size(_listTileHeight, _listTileHeight), + id: widget.id, + selectedRadio: + hyshlx == 'hyfh' && mapGetHycsShenheData['title'] == "非黑烟车" + ? 1 + : 0, + ), + //为了用户在切换审核结果Radio时显示不同图片,必须将以下组件都移入到RadioListItems类中 + // SizedBox(height: 6), + // Divider(height: 1.0, color: Colors.blue), + // SizedBox(height: 10), + // //9、得到审核确认组件 + // getShqr(index), + ], + ), ), - ), - ], - ); - }), - ) - : getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0), //显示加载中的圈圈 + ], + ); + }), + ) + : getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0), //显示加载中的圈圈 + ), ), ), );