scroll_notification_interceptor.dart 501 B

123456789101112131415161718192021
  1. import 'package:flutter/widgets.dart';
  2. // 滚动通知拦截器(用于拦截其他UI组件的滑动事件)
  3. class ScrollNotificationInterceptor extends StatelessWidget {
  4. final Widget child;
  5. ScrollNotificationInterceptor({
  6. Key? key,
  7. required this.child,
  8. }) : super(key: key);
  9. @override
  10. Widget build(BuildContext context) {
  11. return NotificationListener(
  12. onNotification: (ScrollNotification notification) {
  13. return true;
  14. },
  15. child: this.child,
  16. );
  17. }
  18. }