Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 使用省道检测滚动到页面底部的情况_Dart - Fatal编程技术网

Dart 使用省道检测滚动到页面底部的情况

Dart 使用省道检测滚动到页面底部的情况,dart,Dart,我可以通过使用Javascript检测滚动到底部 $(window).on("scroll", function() { var scrollHeight = $(document).height(); var scrollPosition = $(window).height() + $(window).scrollTop(); if ((scrollHeight - scrollPosition) / scrollHeight === 0) { //

我可以通过使用Javascript检测滚动到底部

$(window).on("scroll", function() {
    var scrollHeight = $(document).height();
    var scrollPosition = $(window).height() + $(window).scrollTop();
    if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
        // when scroll to bottom of the page
    }
});
但我在Dart中找不到document.height。
如何获得文档的高度并与window.scrollY进行比较?

我认为,尽管我一直无法理解文档的不同高度,但document.body.clientHeight应该可以工作,即我曾经使用过它

_updateScrollInfo([_]) {
  if (window.innerHeight + window.scrollY >= document.body.clientHeight) {
    print("at bottom");
  }
}
window.onScroll.listen(_updateScrollInfo);

DartPad示例:

我遇到了一个奇怪的问题,我的dart:html项目没有显示window.innerHeight、window.scrollY和document.body.clientHeight的典型值。矿山顶部为1070 | 0 | 1070,底部为1070 | 550 | 1070。我完全被难住了。