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

Release/4.6.1 #75

Merged
merged 6 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [4.6.1]

- Fix empty state.

## [4.6.0]

- Refactored LoadableList & PaginatedeLoadableList constructors signature
Expand Down
4 changes: 3 additions & 1 deletion lib/src/loadable/loadable_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class LoadableListView extends StatefulWidget {
class LoadableListViewState extends State<LoadableListView> {
LoadableListViewModel get viewModel => widget.viewModel;

int get actualItemsCount => viewModel.itemCount;

@override
void initState() {
super.initState();
Expand Down Expand Up @@ -111,7 +113,7 @@ class LoadableListViewState extends State<LoadableListView> {
sliver: SliverList(
delegate: SliverChildBuilderDelegate(
sliverDelegateBuilder,
childCount: _computeActualChildCount(viewModel.itemCount),
childCount: _computeActualChildCount(actualItemsCount),
),
),
),
Expand Down
9 changes: 6 additions & 3 deletions lib/src/loadable/loadable_paginated_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ class LoadablePaginatedListState extends LoadableListViewState {
LoadablePaginatedListViewModel get viewModel =>
widget.viewModel as LoadablePaginatedListViewModel;

@override
int get actualItemsCount => viewModel.itemCount + 1;

@override
Widget buildListItem(int index) {
return index == viewModel.itemCount - 1
return index == actualItemsCount - 1
// ignore: avoid-returning-widgets
? buildLastItem(viewModel.getPaginationState())
: super.buildListItem(index);
Expand Down Expand Up @@ -85,7 +88,7 @@ class LoadablePaginatedListViewModel extends LoadableListViewModel {
required super.errorWidget,
required super.emptyStateWidget,
required super.loadListRequestState,
required int itemCount,
required super.itemCount,
required this.loadPageRequestState,
required this.errorPageWidget,
required this.isAllItemsLoaded,
Expand All @@ -96,7 +99,7 @@ class LoadablePaginatedListViewModel extends LoadableListViewModel {
super.footer,
this.loadPage,
super.key,
}) : super(itemCount: itemCount + 1);
});

final VoidCallback? loadPage;
final Widget errorPageWidget;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dash_kit_core
description: The core component for DashKit that provides basic architecture components
version: 4.6.0
version: 4.6.1
homepage: https://github.com/Dash-Kit/dash-kit-core

environment:
Expand Down
Loading