本文最后更新于 571 天前
1. physics方式
ClampingScrollPhysics() 强制将滚动距离限制最大可滑动
2. 自定义ScrollBehavior
class NoScrollBehaviorWidget 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(
axisDirection: axisDirection,
color: Theme
.of(context)
.accentColor,
child: child,
showTrailing: false,
showLeading: false,);
case TargetPlatform.linux:
break;
case TargetPlatform.macOS:
break;
case TargetPlatform.windows:
break;
}
return child;
}
}