Closed Dboy233 closed 1 year ago
布局中是 CustomScrollView ->child: PageView。当上下滚动的时候刷新正常出现,但是当滚动PageView的时候,有时候就会出现向右滑动左边出现了刷新头。而且还是在布局上方的。
下面是补充的PlaceholderView代码
import 'package:flutter/material.dart'; class PlaceholderView extends StatelessWidget { const PlaceholderView( {super.key, required this.child, this.showEmptyView = false}); final bool showEmptyView; final Widget child; @override Widget build(BuildContext context) { if (showEmptyView) { return const EmptyView(); } return child; } } class EmptyView extends StatelessWidget { const EmptyView({super.key}); @override Widget build(BuildContext context) { return LayoutBuilder( builder: (context, constraints) { return SingleChildScrollView( child: SizedBox( width: constraints.maxWidth, height: constraints.maxHeight, child: const Center( child: Text("暂无数据"), ), ), ); }, ); } }
给PageView设置滚动物理效果为 ClampingScrollPhysics 可解决此问题。
请查看Readme第一条
布局中是 CustomScrollView ->child: PageView。当上下滚动的时候刷新正常出现,但是当滚动PageView的时候,有时候就会出现向右滑动左边出现了刷新头。而且还是在布局上方的。
下面是补充的PlaceholderView代码