Closed chensimin920511 closed 7 months ago
是否可以提供最小的可复现的示例代码?
2.涉及其他的三方库: flutter_screenutil: ^5.8.4 lpinyin: ^2.0.3 provider: 6.0.5
------------------ 原始邮件 ------------------ 发件人: "fluttercandies/flutter_scrollview_observer" @.>; 发送时间: 2024年1月15日(星期一) 晚上7:27 @.>; @.**@.>; 主题: Re: [fluttercandies/flutter_scrollview_observer] [Bug report] onObserve回调,监听数据不全 (Issue #70)
是否可以提供最小的可复现的示例代码?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
额,没有可以直接运行的小项目吗?
小demo晚点给你做一个
------------------ 原始邮件 ------------------ 发件人: "fluttercandies/flutter_scrollview_observer" @.>; 发送时间: 2024年1月15日(星期一) 晚上8:28 @.>; @.**@.>; 主题: Re: [fluttercandies/flutter_scrollview_observer] [Bug report] onObserve回调,监听数据不全 (Issue #70)
额,没有可以直接运行的小项目吗?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
日志如下: I/flutter (28803): onVerticalDragDown: 25, z I/flutter (28803): Observe: a,阿富汗,AreaItemType.item I/flutter (28803): Observe: b,白俄罗斯,AreaItemType.item @.***MainActivity: ViewPostIme pointer 1 I/flutter (28803): onTapDown: I/flutter (28803): onVerticalDragCancel I/flutter (28803): onTapUp: I/flutter (28803): Observe: n,尼加拉瓜,AreaItemType.item
左侧列表滑动observer()只回调了a,b,n
------------------ 原始邮件 ------------------ 发件人: "fluttercandies/flutter_scrollview_observer" @.>; 发送时间: 2024年1月15日(星期一) 晚上8:28 @.>; @.**@.>; 主题: Re: [fluttercandies/flutter_scrollview_observer] [Bug report] onObserve回调,监听数据不全 (Issue #70)
额,没有可以直接运行的小项目吗?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
- 点击主页+,进入选择页面 2.点击右侧底部Z 3.左侧跟随滑动到Z 日志如下: I/flutter (28803): onVerticalDragDown: 25, z I/flutter (28803): Observe: a,阿富汗,AreaItemType.item I/flutter (28803): Observe: b,白俄罗斯,AreaItemType.item @.MainActivity: ViewPostIme pointer 1 I/flutter (28803): onTapDown: I/flutter (28803): onVerticalDragCancel I/flutter (28803): onTapUp: I/flutter (28803): Observe: n,尼加拉瓜,AreaItemType.item 左侧列表滑动observer()只回调了a,b,n … ------------------ 原始邮件 ------------------ 发件人: "fluttercandies/flutter_scrollview_observer" @.>; 发送时间: 2024年1月15日(星期一) 晚上8:28 @.>; @*.**@*.>; 主题: Re: [fluttercandies/flutter_scrollview_observer] [Bug report] onObserve回调,监听数据不全 (Issue #70) 额,没有可以直接运行的小项目吗? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.>
是不是忘记传 demo
了?
因太久没有回复,先关闭了,有补充时可随时重新打开
附加里是有demo的哈。自己复现一下也很简单的,必现
附加里是有demo的哈。自己复现一下也很简单的,必现
@chensimin920511 我这边没看到附件,需要你将该附件在该 issue 的评论对话框里上传一下
@chensimin920511 我这边没看到附件,需要麻烦你将该附件在当前 issue
的评论对话框里上传一下
(会不会引用了内容后,你那边会收不到呢?)
scolltest.zip 把后缀.zip改成.7z。附件不支持.7z哈
但是onObserve( )回调中的数据极少
,你这句话我没太理解,是指上面录屏中打印的 b c i m...
中间少了的 d e f g h
?
如果是的话,那是正常的,scrollview_observer
的内部是靠监听 ScrollNotification
,你用 NotificationListener
监听后打印 pixel
就能理解了
Widget _buildListLeft(List<AreaInfo> source) {
Widget resultWidget = Container(
margin: EdgeInsets.only(top: marginTop, left: 25.w, right: 25.w),
child: ListViewObserver(
onObserve: (model) {
int? index = model.firstChild?.index;
if (index != null) {
///例如:处理A B滑动临界点的问题
index++;
if (index >= source.length) {
index = source.length - 1;
}
print(
"Observe: ${areaList[index].getKeyLetter()},${areaList[index].name},${areaList[index].type}");
_model.scrollKey =
letterList.indexOf(areaList[index].getKeyLetter());
}
},
child: ListView.builder(
itemCount: source.length,
controller: _controller,
itemBuilder: (context, index) => _buildAreaItem(source[index])),
),
);
resultWidget = NotificationListener<ScrollNotification>(
child: resultWidget,
onNotification: (notification) {
print('notification -- $notification - ${notification.metrics.pixels}');
return false;
},
);
return resultWidget;
}
flutter: notification -- ScrollStartNotification(depth: 0 (local), FixedScrollMetrics(0.0..[843.4]..20756.9)) - 0.0
flutter: notification -- ScrollUpdateNotification(depth: 0 (local), FixedScrollMetrics(833.0..[843.4]..19923.9), scrollDelta: 833.0410666666668) - 833.0410666666668
flutter: notification -- ScrollUpdateNotification(depth: 0 (local), FixedScrollMetrics(2579.2..[843.4]..18177.7), scrollDelta: 1746.1117661458334) - 2579.1528328125
flutter: notification -- ScrollUpdateNotification(depth: 0 (local), FixedScrollMetrics(6697.8..[843.4]..14059.1), scrollDelta: 4118.651315625) - 6697.804148437501
flutter: notification -- ScrollUpdateNotification(depth: 0 (local), FixedScrollMetrics(10750.5..[843.4]..10006.4), scrollDelta: 4052.64788034668) - 10750.45202878418
flutter: notification -- ScrollUpdateNotification(depth: 0 (local), FixedScrollMetrics(11430.6..[843.4]..9326.3), scrollDelta: 680.1948116455078) - 11430.646840429688
flutter: notification -- ScrollUpdateNotification(depth: 0 (local), FixedScrollMetrics(11577.3..[843.4]..9179.6), scrollDelta: 146.64604136556045) - 11577.292881795249
flutter: notification -- ScrollUpdateNotification(depth: 0 (local), FixedScrollMetrics(11621.7..[843.4]..9135.2), scrollDelta: 44.4225815130867) - 11621.715463308336
flutter: notification -- ScrollUpdateNotification(depth: 0 (local), FixedScrollMetrics(11621.7..[843.4]..9135.2), scrollDelta: 0.001870024998424924) - 11621.717333333334
flutter: notification -- ScrollEndNotification(depth: 0 (local), FixedScrollMetrics(11621.7..[843.4]..9135.2)) - 11621.717333333334
监听的滚动通知发多少次,scrollview_observer
就观察多少次
Version
1.19.0
Platforms
Android
Device Model
Galaxy A54(Android 13)
flutter info
How to reproduce?
类似于一个手机国家区号选择的功能。左侧是200多条的区号数据,右侧是从A-Z的国家首字母列表。代码逻辑大致如下:
Logs
Example code (optional)
Contact
3581172209@qq.com