正文ScrollConfiguration(behavior: NoScrollBehaviorWidget(),child: ListView(
正文
ScrollConfiguration( behavior: NoScrollBehaviorWidget(), child: ListView( ...... ...... ), ),
- 调用ScrollConfiguration官方类,实现behavior
- NoScrollBehaviorWidget用于去除水波纹的自定义Widget
import 'package:flutter/material.dart'; /// 去除listview水印 /// ScrollConfiguration behavior 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; } }
以上就是Flutter开发技巧ListView去除水波纹方法示例的详细内容,更多关于Flutter ListView去除水波纹的资料请关注好代码网其它相关文章!