✨ Comment view
This commit is contained in:
@ -48,13 +48,13 @@ class _ExploreScreenState extends State<ExploreScreen> {
|
||||
final result =
|
||||
PaginationResult.fromJson(jsonDecode(utf8.decode(res.bodyBytes)));
|
||||
final isLastPage = (result.count - pageKey) < pageSize;
|
||||
final items =
|
||||
result.data?.map((x) => Feed.fromJson(x)).toList() ?? List.empty();
|
||||
if (isLastPage || result.data == null) {
|
||||
paginationController.appendLastPage(feed);
|
||||
paginationController.appendLastPage(items);
|
||||
} else {
|
||||
final feed =
|
||||
result.data?.map((x) => Feed.fromJson(x)).toList() ?? List.empty();
|
||||
final nextPageKey = pageKey + feed.length;
|
||||
paginationController.appendPage(feed, nextPageKey);
|
||||
final nextPageKey = pageKey + items.length;
|
||||
paginationController.appendPage(items, nextPageKey);
|
||||
}
|
||||
} else {
|
||||
paginationController.error = utf8.decode(res.bodyBytes);
|
||||
|
Reference in New Issue
Block a user