我想念什么吗?该文档说,事件从最里面的孩子到祖先冒泡,但是下面的代码不会在控制台上“打印”。它确实打印“点击”。 将NeverScrollablePhyiscs应用于ListView确实可以,但是我想在两个级别上监听该事件。将HitTestBehavior.translucent应用于GestureDetector不会改变任何内容。
<nav id="ac-globalnav" class="js no-touch" role="navigation" aria-label="Global" data-hires="false" data-analytics-region="global nav" lang="en-US" dir="ltr" data-store-locale="us" data-store-api="/[storefront]/shop/bag/status" data-search-locale="en_US" data-search-api="/search-services/suggestions/">
<div class="ac-gn-content">
<ul class="ac-gn-header">
<li class="ac-gn-item ac-gn-menuicon">
<label class="ac-gn-menuicon-label" for="ac-gn-menustate" aria-hidden="true">
<span class="ac-gn-menuicon-bread ac-gn-menuicon-bread-top">
<span class="ac-gn-menuicon-bread-crust ac-gn-menuicon-bread-crust-top"></span>
</span>
<span class="ac-gn-menuicon-bread ac-gn-menuicon-bread-bottom">
<span class="ac-gn-menuicon-bread-crust ac-gn-menuicon-bread-crust-bottom"></span>
</span>
</label>
<a href="#ac-gn-menustate" class="ac-gn-menuanchor ac-gn-menuanchor-open" id="ac-gn-menuanchor-open">
<span class="ac-gn-menuanchor-label">Open Menu</span>
</a>
<a href="#" class="ac-gn-menuanchor ac-gn-menuanchor-close" id="ac-gn-menuanchor-close">
<span class="ac-gn-menuanchor-label">Close Menu</span>
</a>
</li>
<li class="ac-gn-item ac-gn-apple">
<a class="ac-gn-link ac-gn-link-apple" href="/" data-analytics-title="apple home" id="ac-gn-firstfocus-small">
<span class="ac-gn-link-text">Apple</span>
</a>
</li>
<li class="ac-gn-item ac-gn-bag ac-gn-bag-small" id="ac-gn-bag-small">
<a class="ac-gn-link ac-gn-link-bag" href="/us/shop/goto/bag" data-analytics-title="bag" data-analytics-click="bag" aria-label="Shopping Bag" data-string-badge="Shopping Bag with Items" role="button" aria-haspopup="true" aria-expanded="false" aria-controls="ac-gn-bagview-content">
<span class="ac-gn-link-text">Shopping Bag</span>
<span class="ac-gn-bag-badge"></span>
</a>
<span class="ac-gn-bagview-caret ac-gn-bagview-caret-large"></span>
</li>
</ul>
<div class="ac-gn-search-placeholder-container" role="search">
<div class="ac-gn-search ac-gn-search-small">
<a id="ac-gn-link-search-small" class="ac-gn-link" href="/us/search" data-analytics-title="search" data-analytics-click="search" data-analytics-intrapage-link="" aria-label="Search apple.com" role="button" aria-haspopup="true">
<div class="ac-gn-search-placeholder-bar">
<div class="ac-gn-search-placeholder-input">
<div class="ac-gn-search-placeholder-input-text" aria-hidden="true">
<div class="ac-gn-link-search ac-gn-search-placeholder-input-icon"></div>
<span class="ac-gn-search-placeholder">Search apple.com</span>
</div>
</div>
<div class="ac-gn-searchview-close ac-gn-searchview-close-small ac-gn-search-placeholder-searchview-close">
<span class="ac-gn-searchview-close-cancel" aria-hidden="true">Cancel</span>
</div>
</div>
</a>
</div>
</div>
<ul class="ac-gn-list">
<li class="ac-gn-item ac-gn-apple">
<a class="ac-gn-link ac-gn-link-apple" href="/" data-analytics-title="apple home" id="ac-gn-firstfocus">
<span class="ac-gn-link-text">Apple</span>
</a>
</li>
<li class="ac-gn-item ac-gn-item-menu ac-gn-mac">
<a class="ac-gn-link ac-gn-link-mac" href="/mac/" data-analytics-title="mac">
<span class="ac-gn-link-text">Mac</span>
</a>
</li>
<li class="ac-gn-item ac-gn-item-menu ac-gn-ipad">
<a class="ac-gn-link ac-gn-link-ipad" href="/ipad/" data-analytics-title="ipad">
<span class="ac-gn-link-text">iPad</span>
</a>
</li>
<li class="ac-gn-item ac-gn-item-menu ac-gn-iphone">
<a class="ac-gn-link ac-gn-link-iphone" href="/iphone/" data-analytics-title="iphone">
<span class="ac-gn-link-text">iPhone</span>
</a>
</li>
<li class="ac-gn-item ac-gn-item-menu ac-gn-watch">
<a class="ac-gn-link ac-gn-link-watch" href="/watch/" data-analytics-title="watch">
<span class="ac-gn-link-text">Watch</span>
</a>
</li>
<li class="ac-gn-item ac-gn-item-menu ac-gn-tv">
<a class="ac-gn-link ac-gn-link-tv" href="/tv/" data-analytics-title="tv">
<span class="ac-gn-link-text">TV</span>
</a>
</li>
<li class="ac-gn-item ac-gn-item-menu ac-gn-music">
<a class="ac-gn-link ac-gn-link-music" href="/music/" data-analytics-title="music">
<span class="ac-gn-link-text">Music</span>
</a>
</li>
<li class="ac-gn-item ac-gn-item-menu ac-gn-support">
<a class="ac-gn-link ac-gn-link-support" href="https://support.apple.com" data-analytics-title="support">
<span class="ac-gn-link-text">Support</span>
</a>
</li>
<li class="ac-gn-item ac-gn-item-menu ac-gn-search" role="search">
<a id="ac-gn-link-search" class="ac-gn-link ac-gn-link-search" href="/us/search" data-analytics-title="search" data-analytics-click="search" data-analytics-intrapage-link="" aria-label="Search apple.com" role="button" aria-haspopup="true"></a>
</li>
<li class="ac-gn-item ac-gn-bag" id="ac-gn-bag">
<a class="ac-gn-link ac-gn-link-bag" href="/us/shop/goto/bag" data-analytics-title="bag" data-analytics-click="bag" aria-label="Shopping Bag" data-string-badge="Shopping Bag with Items" role="button" aria-haspopup="true" aria-expanded="false" aria-controls="ac-gn-bagview-content">
<span class="ac-gn-link-text">Shopping Bag</span>
<span class="ac-gn-bag-badge" aria-hidden="true"></span>
</a>
<span class="ac-gn-bagview-caret ac-gn-bagview-caret-large"></span>
</li>
</ul>
<aside id="ac-gn-searchview" class="ac-gn-searchview" role="search" data-analytics-region="search">
<div class="ac-gn-searchview-content">
<div class="ac-gn-searchview-bar">
<div class="ac-gn-searchview-bar-wrapper">
<form id="ac-gn-searchform" class="ac-gn-searchform" action="/us/search" method="get">
<div class="ac-gn-searchform-wrapper">
<input id="ac-gn-searchform-input" class="ac-gn-searchform-input" type="text" aria-label="Search apple.com" placeholder="Search apple.com" autocorrect="off" autocapitalize="off" autocomplete="off" spellcheck="false">
<input id="ac-gn-searchform-src" type="hidden" name="src" value="globalnav">
<button id="ac-gn-searchform-submit" class="ac-gn-searchform-submit" type="submit" disabled="" aria-label="Submit Search"></button>
<button id="ac-gn-searchform-reset" class="ac-gn-searchform-reset" type="reset" disabled="" aria-label="Clear Search">
<span class="ac-gn-searchform-reset-background"></span>
</button>
</div>
</form>
<button id="ac-gn-searchview-close-small" class="ac-gn-searchview-close ac-gn-searchview-close-small" aria-label="Cancel Search">
<span class="ac-gn-searchview-close-cancel" aria-hidden="true">
Cancel
</span>
</button>
</div>
</div>
<aside id="ac-gn-searchresults" class="ac-gn-searchresults" data-string-quicklinks="Quick Links" data-string-suggestions="Suggested Searches" data-string-noresults=""> <section class="ac-gn-searchresults-section ac-gn-searchresults-section-defaultlinks" data-analytics-region="defaultlinks search">
<div class="ac-gn-searchresults-section-wrapper">
<h3 class="ac-gn-searchresults-header ac-gn-searchresults-animated">Quick Links</h3>
<ul class="ac-gn-searchresults-list">
<li class="ac-gn-searchresults-item ac-gn-searchresults-animated">
<a href="https://www.apple.com/retail/" class="ac-gn-searchresults-link ac-gn-searchresults-link-defaultlinks" data-query="no keyword" data-section="defaultlinks" data-items="5" data-index="0" data-label="Find a Store" data-analytics-click="eVar23: {data-query} | {data-section} | {data-items} | {data-label} | {data-index}, events:event50">Find a Store</a>
</li>
<li class="ac-gn-searchresults-item ac-gn-searchresults-animated">
<a href="https://www.apple.com/us/shop/goto/accessories/apple_accessories" class="ac-gn-searchresults-link ac-gn-searchresults-link-defaultlinks" data-query="no keyword" data-section="defaultlinks" data-items="5" data-index="1" data-label="Accessories" data-analytics-click="eVar23: {data-query} | {data-section} | {data-items} | {data-label} | {data-index}, events:event50">Accessories</a>
</li>
<li class="ac-gn-searchresults-item ac-gn-searchresults-animated">
<a href="https://www.apple.com/ipod/" class="ac-gn-searchresults-link ac-gn-searchresults-link-defaultlinks" data-query="no keyword" data-section="defaultlinks" data-items="5" data-index="2" data-label="iPod" data-analytics-click="eVar23: {data-query} | {data-section} | {data-items} | {data-label} | {data-index}, events:event50">iPod</a>
</li>
<li class="ac-gn-searchresults-item ac-gn-searchresults-animated">
<a href="https://www.apple.com/ios/" class="ac-gn-searchresults-link ac-gn-searchresults-link-defaultlinks" data-query="no keyword" data-section="defaultlinks" data-items="5" data-index="3" data-label="iOS" data-analytics-click="eVar23: {data-query} | {data-section} | {data-items} | {data-label} | {data-index}, events:event50">iOS</a>
</li>
<li class="ac-gn-searchresults-item ac-gn-searchresults-animated">
<a href="https://www.apple.com/us/shop/goto/giftcards" class="ac-gn-searchresults-link ac-gn-searchresults-link-defaultlinks" data-query="no keyword" data-section="defaultlinks" data-items="5" data-index="4" data-label="Gift Cards" data-analytics-click="eVar23: {data-query} | {data-section} | {data-items} | {data-label} | {data-index}, events:event50">Gift Cards</a>
</li>
</ul>
</div>
</section>
答案 0 :(得分:2)
您可以使用Listener
return Scaffold(
body: Listener(onPointerMove: (opm) {
print("onPointerMove .. ${opm.position}");
}, child: ListView.builder(
itemBuilder: (context, index) {
return Container(
padding: EdgeInsets.all(20.0),
child: Text(
"The GestureDetector above me does not react to drag events. Maybe my parent is at fault?"));
},
)));