listview_overScrollbehavior.dart
import 'package:flutter/material.dart'; /* * $作用:去除ListView 滑動波紋 * $參考:https://blog.csdn.net/u013894711/article/details/102572581 * */ class OverScrollBehavior extends ScrollBehavior{ @override Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) { switch (getPlatform(context)) { case TargetPlatform.iOS: return child; case TargetPlatform.android: case TargetPlatform.fuchsia: return GlowingOverscrollIndicator( child: child, //不显示头部水波纹 showLeading: false, //不显示尾部水波纹 showTrailing: false, axisDirection: axisDirection, color: Theme.of(context).accentColor, ); } return null; } }
ListView
child: ScrollConfiguration( behavior: OverScrollBehavior(), child: _list.length==0?Text('暫無數據'):ListView.separated( scrollDirection: Axis.horizontal, itemBuilder:(BuildContext context,int index)=> _buildRow(index), separatorBuilder: (BuildContext context,int index)=> Divider(), itemCount: _list.length, ) ),