Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用EasyRefresh+CustomScrollView+SliverToBoxAdapter时,若SliverToBoxAdapter内包含非固定高度的widget,header显示异常 #869

Open
KaiLiDev opened this issue Oct 17, 2024 · 2 comments

Comments

@KaiLiDev
Copy link

使用EasyRefresh+CustomScrollView+SliverToBoxAdapter时,若SliverToBoxAdapter内包含非固定高度的widget,自定义的header显示异常;自定义Header是使用的ClassicHeader源码修改,下拉时只显示一个loading,完成之后显示文字;
`class _CusEasyRefreshState extends State {

@OverRide
Widget build(BuildContext context) {
return EasyRefresh(
onRefresh: widget.onRefresh,
onLoad: widget.onLoad,
header: _getClassicHeader(),
footer: _getFooter(),
child: CustomScrollView(
slivers: [
const HeaderLocator.sliver(),
if (widget.buildSliverToBoxAdapter != null)
SliverToBoxAdapter(
child: Expanded(child: widget.buildSliverToBoxAdapter!.call()??Container())),
widget.buildMainScrollWidget(),
const FooterLocator.sliver(),
],
),
);
}

_getClassicHeader() {
return const CusClassicHeader(
showMessage: false,
spacing: 0,
showText: true,
safeArea: false,
triggerOffset: 50,
maxOverOffset: 50,
position: IndicatorPosition.above,
mainAxisAlignment: MainAxisAlignment.center,
dragText: '',
armedText: '',
readyText: '',
processingText: '',
processedText: '已经加载全部',
noMoreText: '无更多数据',
failedText: '加载失败',
messageText: '上次更新 %T',
);
}

_getFooter() {
return ClassicFooter(
spacing: 0,
pullIconBuilder:
(BuildContext context, IndicatorState state, double animation) {
return Container();
},
// succeededIcon: null,
noMoreIcon: const SizedBox(),
failedIcon: const SizedBox(),
iconDimension: 0,
showMessage: false,
position: IndicatorPosition.locator,
dragText: '上拉加载',
armedText: '松手加载',
readyText: '正在加载...',
processingText: '正在加载...',
processedText: '已全部加载',
noMoreText: '已全部加载',
failedText: '加载失败',
messageText: '上次更新 %T',
);
}
}`

@KaiLiDev
Copy link
Author

下拉异常时,loading框没了

@xuelongqy
Copy link
Owner

你把Expanded去掉试试看?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants