亲宝软件园·资讯

展开

Flutter开发技巧ListView去除水波纹方法示例

Asscre 人气:0

正文

ScrollConfiguration(
   behavior: NoScrollBehaviorWidget(),
   child: ListView(
    ......
    ......
    ),
 ),
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;
  }
}

加载全部内容

相关教程
猜你喜欢
用户评论