我想在RefreshIndicator中实现水平PageView.builder。如果用户滚动到最后,我想刷新并获取新数据,但我试图下拉刷新,但指示器没有出现,也不会获取新数据。我该怎么做呢?
return new Scaffold(
appBar: new AppBar(),
body: new RefreshIndicator(
onRefresh: _onRefresh,
child: new PageView.builder(
scrollDirection: Axis.horizontal,
我使用的是RefreshIndicator小部件-其用法类似于: RefreshIndicator(
onRefresh: () => refreshState(), // Invokes a method on a state object that is mocked in my test
child: ... 现在我想验证一下,“下拉”手势是否会导致调用refreshState testWidgets('Pulling down triggers refresh', (tester) async {
var state = MockState();
当我将StreamBuilder放入RefreshIndicator中时,它会多次使用滚动操作呈现小部件。我想避免太多它,因为StreamBuilder中的图表会有很多次动画效果。 我使用以下环境进行了测试。 $ flutter doctor -v
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.13.6 17G5019, locale en-JP)
• Flutter version 1.2.1 at /Users/matsue/work/flutter/flutter_macos_v1.0.0-stable
• Fr
我想2个选项卡页,每个都有一个ListView共享一个RefreshIndicator。但是,RefreshIndicator必须作为子标签具有可滚动属性(而TabBarView不是),所以我尝试让每个标签有2个RefreshIndicators,如下面的代码所示。
但这带来了一个不同的问题,我也想要一个浮动的AppBar,这意味着我必须使用NestedScrollView。因此,当我向下滚动时,我最终触发了两个RefreshIndicators的onRefresh方法。而我只需要一个来刷新。
import 'package:flutter/material.dart';
m
我正在使用RefreshIndicator刷新互联网上的数据,但当我从顶部向下拉时,刷新图标并没有消失,还出现了一个错误:
════════ Exception caught by material library ══════════════════════════════════
The following assertion was thrown when calling onRefresh:
The onRefresh callback returned null.
The RefreshIndicator onRefresh callback must return a Futur
Flutter代码问题:我想在listview中创建分页。我使用PagewiseListview成功地实现了这一点。但现在我想使用‘PulltoRefresh _ to _ PagewiseListView’包在我的刷新中添加刷新。下面是我的代码片段。 我想在SmartRefresher中包装PagewiseListView。目前,我使用的是RefreshIndicator。 class PagewiseListViewExample extends State<ListPage> {
static const int PAGE_SIZE = 10;
final Glob