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

smart refresher doesn't work on GroupListView #630

Open
abdulkash opened this issue May 2, 2023 · 0 comments
Open

smart refresher doesn't work on GroupListView #630

abdulkash opened this issue May 2, 2023 · 0 comments

Comments

@abdulkash
Copy link

abdulkash commented May 2, 2023

Here is the code
SmartRefresher(
controller: controller,
enablePullDown: true,
enablePullUp: true,
physics: const AlwaysScrollableScrollPhysics(),
onRefresh: () async {
await ref.read(transactionsProvider.notifier).refreshTransactions(page: page);
controller.refreshCompleted();
},
footer: CustomFooter(builder: (_, mode) {
switch (mode) {
case LoadStatus.idle:
return const SizedBox(
height: 55.0,
child: Center(
child: Text("pull up load"),
),
);
case LoadStatus.loading:
return const SizedBox(
height: 55.0,
child: Center(
child: CupertinoActivityIndicator(),
),
);
case LoadStatus.failed:
return const SizedBox(
height: 55.0,
child: Center(
child: Text('Failed to load transactions'),
),
);
case LoadStatus.canLoading:
return const SizedBox(
height: 55.0,
child: Center(
child: Text('Release to load more'),
),
);
default:
return const SizedBox(
height: 55.0,
child: Center(
child: Text('No more data'),
),
);
}
}),
onLoading: _onLoading,
child: GroupedListView<TransactionItemEntity, DateTime>(
physics: const AlwaysScrollableScrollPhysics(),
elements: data.data.data,
groupBy: (element) => DateTime(
element.createdAt.year,
element.createdAt.month,
element.createdAt.day,
),
groupSeparatorBuilder: (groupByValue) => Padding(
padding: const EdgeInsets.only(left: 0, bottom: 15, top: 15),
child: Text(
ref.watch(transactionsProvider.notifier).checkDate(groupByValue),
style: Theme.of(context).textTheme.bodyLarge,
),
),
itemBuilder: (context, element) {
return TransactionItem(
entity: element,
);
},
useStickyGroupSeparators: false, // optional
floatingHeader: false, // optional
order: GroupedListOrder.DESC, // optional
),
),

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

1 participant