Now I am using SmartRefresher
to refresh my app when pull down article list, I add pull_to_refresh
dependencies in pubspec.yaml
like this:
pull_to_refresh: 1.6.3
and this is my code:
child: CupertinoScrollbar(
child: SmartRefresher(
onRefresh: _onRefresh,
enablePullUp: true,
enablePullDown: true,
header: WaterDropMaterialHeader(),
controller: _refreshController,
onLoading: _loadingMoreArticle,
footer: CustomFooter(
builder: (BuildContext context, LoadStatus mode) {
Widget body;
if (mode == LoadStatus.idle) {
body = Text("上拉加载更多");
} else if (mode == LoadStatus.loading) {
body = CupertinoActivityIndicator();
} else if (mode == LoadStatus.failed) {
body = Text("加载失败!点击重试!");
} else if (mode == LoadStatus.canLoading) {
body = Text("release to load more");
} else {
body = Text("No more Data");
}
return Container(
height: 55.0,
child: Center(child: body),
);
},
),
child: CupertinoScrollbar(
child: CustomScrollView(
controller: scrollController,
slivers: <Widget>[
SliverOverlapInjector(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
context,
),
),
if (state.articleListState.articleIds != null && state.articleListState.articleIds.length > 0)
SliverPadding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
sliver: viewService.buildComponent("articlelist"),
)
],
)))));
but the UI does not contain any effect of SmartRefresher
, the header shows nothing when pull, and the footer shows nothing when push up, am I missing something? what should I do to fix it? Now I am using macOS Catalina 10.15.7
and Android Studio 4.1.2
.
$ dart --version
Dart SDK version: 2.10.2 (stable) (Tue Oct 13 15:50:27 2020 +0200) on "macos_x64"
(base)
$ ~/apps/flutter/bin/flutter --version
Flutter 1.22.5 ? channel stable ? https://github.com/flutter/flutter.git
Framework ? revision 7891006299 (7 weeks ago) ? 2020-12-10 11:54:40 -0800
Engine ? revision ae90085a84
Tools ? Dart 2.10.4
(base)
this is the header shows when pull down:
question from:
https://stackoverflow.com/questions/65931277/why-the-smartrefresher-does-not-work-in-flutter 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…