1234567891011121314151617181920212223242526272829303132333435363738 |
- import 'package:flutter/material.dart';
- class OverScrollBehavior extends ScrollBehavior {
- final bool isShowLeading;
- final bool isShowTrailing;
- OverScrollBehavior({this.isShowLeading = true, this.isShowTrailing = true});
- @override
- Widget buildOverscrollIndicator(
- BuildContext context, Widget child, ScrollableDetails details) {
- switch (getPlatform(context)) {
- case TargetPlatform.iOS:
- return child;
- case TargetPlatform.android:
- case TargetPlatform.fuchsia:
- return GlowingOverscrollIndicator(
- child: child,
- //不显示头部水波纹
- showLeading: false,
- //不显示尾部水波纹
- showTrailing: false,
- axisDirection: details.direction,
- color: Theme.of(context).colorScheme.secondary,
- );
- case TargetPlatform.linux:
- // TODO: Handle this case.
- break;
- case TargetPlatform.macOS:
- // TODO: Handle this case.
- break;
- case TargetPlatform.windows:
- // TODO: Handle this case.
- break;
- }
- return child;
- }
- }
|