Skip to content

Instantly share code, notes, and snippets.

@zmtzawqlp
Created December 21, 2018 05:04
Show Gist options
  • Save zmtzawqlp/653f92071584939f759d559e724ddc04 to your computer and use it in GitHub Desktop.
Save zmtzawqlp/653f92071584939f759d559e724ddc04 to your computer and use it in GitHub Desktop.
CustomScrollBehavior水波纹
import 'package:flutter/material.dart';
class CustomScrollBehavior extends ScrollBehavior {
@override
Widget buildViewportChrome(
BuildContext context, Widget child, AxisDirection axisDirection) {
// TODO: implement buildViewportChrome
switch (getPlatform(context)) {
case TargetPlatform.iOS:
return child;
case TargetPlatform.android:
case TargetPlatform.fuchsia:
return GlowingOverscrollIndicator(
showTrailing: true,
showLeading: false,
child: child,
axisDirection: axisDirection,
color: Colors.blue,
);
}
return null;
//super.buildViewportChrome(context, child, axisDirection)
}
//// @override
// ScrollPhysics getScrollPhysics(BuildContext context) {
// // TODO: implement getScrollPhysics
// return CustomNestedScrollViewFixPinnedScrollPhysics(pinnedHeight);
// return super.getScrollPhysics(context);
// }
//
// @override
// bool shouldNotify(ScrollBehavior oldDelegate) {
// // TODO: implement shouldNotify
// return true;
// return pinnedHeight != (oldDelegate as CustomScrollBehavior).pinnedHeight;
// return super.shouldNotify(oldDelegate);
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment