Closed laiiihz closed 1 year ago
since flutter 3.3 landed on stable , flutter add a new pointer device (trackpad). this PR exposure a api which can define a custom scroll behavior.
example:
class CustomScrollBehavior extends ScrollBehavior { final ScrollPhysics? _physics; const CustomScrollBehavior([this._physics]); @override ScrollPhysics getScrollPhysics(BuildContext context) { return _physics ?? super.getScrollPhysics(context); } @override Widget buildViewportChrome( BuildContext context, Widget child, AxisDirection axisDirection) { return child; } @override Set<PointerDeviceKind> get dragDevices => <PointerDeviceKind>{ PointerDeviceKind.touch, PointerDeviceKind.stylus, PointerDeviceKind.invertedStylus, PointerDeviceKind.mouse, PointerDeviceKind.unknown, // add a trackpad PointerDeviceKind.trackpad, }; }
EasyRefresh( scrollBehaviorBuilder: (physics) { return CustomScrollBehavior(physics); }, onRefresh: () async {}, child: ListView.builder( itemBuilder: (context, index) { return const SkeletonItem(); }, itemCount: 8, ), )
Thanks, this looks great.
since flutter 3.3 landed on stable , flutter add a new pointer device (trackpad). this PR exposure a api which can define a custom scroll behavior.
example: