Skip to content

Commit

Permalink
fix: contacts on refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
drminh2807 authored and hoangdat committed Oct 9, 2023
1 parent 3a675e6 commit 3f2e329
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/pages/contacts_tab/contacts_tab_body_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ContactsTabBodyView extends StatelessWidget {
Widget build(BuildContext context) {
if (controller.refreshController == null) return const SizedBox();
return TwakeSmartRefresher(
onRefresh: controller.fetchContacts,
onLoading: controller.loadMoreContacts,
controller: controller.refreshController!,
slivers: [
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/twake_components/twake_smart_refresher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ class _TwakeSmartRefresherController extends State<TwakeSmartRefresher> {
}

Future<void> onRefresh() async {
if (widget.controller.isRefeshing) return;
if (widget.controller.isRefeshing || widget.onRefresh == null) return;
widget.controller.onRefresh();
widget.onRefresh?.call();
}

Future<void> onLoading() async {
if (widget.controller.isLoading) return;
if (widget.controller.isLoading || widget.onLoading == null) return;
widget.controller.onLoading();
await widget.onLoading!();
}
Expand Down

0 comments on commit 3f2e329

Please sign in to comment.