{"id":679,"date":"2023-04-29T16:12:17","date_gmt":"2023-04-29T08:12:17","guid":{"rendered":"http:\/\/gjweb.top\/?p=679"},"modified":"2023-04-29T16:12:18","modified_gmt":"2023-04-29T08:12:18","slug":"%e4%bc%98%e5%8c%96-listview-%e7%bb%84%e4%bb%b6%e6%b8%b2%e6%9f%93","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=679","title":{"rendered":"\u4f18\u5316 ListView \u7ec4\u4ef6\u6e32\u67d3"},"content":{"rendered":"\n<p>\u573a\u666f\uff1a\u5728\u4f7f\u7528 ListView \u7ec4\u4ef6\u65f6\u5019\uff0c\u5982\u679c\u6e32\u67d3\u591a\u4e2a input \u7ec4\u4ef6\uff0c\u5728\u6eda\u52a8\u65f6\u4f1a\u51fa\u73b0 input \u7684\u503c\u88ab\u9500\u6bc1\uff1b \u539f\u56e0\u5728\u4e8e listView \u7ec4\u4ef6\u7684\u5783\u573e\u56de\u6536\u673a\u5236\uff0c\u5982\u679c\u5b50\u7ec4\u4ef6\u8131\u79bb\u4e86\u89c6\u53e3\u4f1a\u5728\u5185\u5b58\u4e2d\u9500\u6bc1\uff0c\u7b49\u4e0b\u6b21\u4f1a\u88ab\u91cd\u65b0\u6e32\u67d3<\/p>\n\n\n\n<p>\u4f7f\u7528 SingleChildScrollView \u66ff\u4ee3 ListView<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SingleChildScrollView (<br>    children:&#91;]<br>)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u4f18\u5316-listview-\u7ec4\u4ef6\u7684\u6c34\u6ce2\u7eb9\u6548\u679c\">\u4f18\u5316 Listview \u7ec4\u4ef6\u7684\u6c34\u6ce2\u7eb9\u6548\u679c<\/h2>\n\n\n\n<p>\u9700\u8981\u5c01\u88c5\u4e00\u4e2a NoShadowScrollBehavior \u65b9\u6cd5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u81ea\u5b9a\u4e49\u7ec4\u4ef6\u53d6\u6d88\u6c34\u6ce2\u7eb9<br>import 'package:flutter\/material.dart';<br>\u200b<br>class NoShadowScrollBehavior extends ScrollBehavior {<br> &nbsp;@override<br> &nbsp;Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) {<br> &nbsp; &nbsp;switch (getPlatform(context)) {<br> &nbsp; &nbsp; &nbsp;case TargetPlatform.iOS:<br> &nbsp; &nbsp; &nbsp;case TargetPlatform.macOS:<br> &nbsp; &nbsp; &nbsp; &nbsp;return child;<br> &nbsp; &nbsp; &nbsp;case TargetPlatform.android:<br> &nbsp; &nbsp; &nbsp;case TargetPlatform.fuchsia:<br> &nbsp; &nbsp; &nbsp;case TargetPlatform.linux:<br> &nbsp; &nbsp; &nbsp;case TargetPlatform.windows:<br> &nbsp; &nbsp; &nbsp; &nbsp;return GlowingOverscrollIndicator(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;child: child,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u4e0d\u663e\u793a\u5934\u90e8\u6c34\u6ce2\u7eb9<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;showLeading: false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u4e0d\u663e\u793a\u5c3e\u90e8\u6c34\u6ce2\u7eb9<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;showTrailing: false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;axisDirection: axisDirection,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color: Theme.of(context).accentColor,<br> &nbsp; &nbsp; &nbsp;  );<br> &nbsp;  }<br>  }<br>}<\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528 ScrollConfiguration \u7ec4\u4ef6\u5305\u88f9 ListView \u7ec4\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ScrollConfiguration(<br> &nbsp; &nbsp;behavior: NoShadowScrollBehavior(),<br> &nbsp; &nbsp;child:ListView(<br> &nbsp;      children:&#91;]<br> &nbsp;  )<br>)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u573a\u666f\uff1a\u5728\u4f7f\u7528 ListView \u7ec4\u4ef6\u65f6\u5019\uff0c\u5982\u679c\u6e32\u67d3\u591a\u4e2a input \u7ec4\u4ef6\uff0c\u5728\u6eda\u52a8\u65f6\u4f1a\u51fa\u73b0 input \u7684\u503c\u88ab\u9500 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[63],"tags":[],"class_list":["post-679","post","type-post","status-publish","format-standard","hentry","category-flutter"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=679"}],"version-history":[{"count":1,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/679\/revisions"}],"predecessor-version":[{"id":680,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/679\/revisions\/680"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}