mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-15 17:47:53 +00:00
shows a loading indicator when loading.
This commit is contained in:
@ -42,11 +42,9 @@ class _SpaceManagementCommunitiesTreeState
|
||||
}
|
||||
|
||||
void _onSearchChanged(String searchQuery) {
|
||||
context.read<CommunitiesBloc>().add(
|
||||
LoadCommunities(LoadCommunitiesParam(
|
||||
search: searchQuery.trim(),
|
||||
)),
|
||||
);
|
||||
context
|
||||
.read<CommunitiesBloc>()
|
||||
.add(LoadCommunities(LoadCommunitiesParam(search: searchQuery.trim())));
|
||||
}
|
||||
|
||||
void _onLoadMore() {
|
||||
@ -80,6 +78,13 @@ class _SpaceManagementCommunitiesTreeState
|
||||
CommunitiesStatus.success => _buildCommunitiesTree(context, state),
|
||||
CommunitiesStatus.failure => _buildErrorState(context, state),
|
||||
},
|
||||
Visibility(
|
||||
visible: state.isLoadingMore,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -132,14 +137,24 @@ class _SpaceManagementCommunitiesTreeState
|
||||
}
|
||||
|
||||
return Expanded(
|
||||
child: SpaceManagementSidebarCommunitiesList(
|
||||
communities: state.communities,
|
||||
onLoadMore: state.hasNext ? _onLoadMore : null,
|
||||
isLoadingMore: state.isLoadingMore,
|
||||
hasNext: state.hasNext,
|
||||
itemBuilder: (context, index) {
|
||||
return _buildCommunityTile(context, state.communities[index]);
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
SpaceManagementSidebarCommunitiesList(
|
||||
communities: state.communities,
|
||||
onLoadMore: state.hasNext ? _onLoadMore : null,
|
||||
isLoadingMore: state.isLoadingMore,
|
||||
hasNext: state.hasNext,
|
||||
itemBuilder: (context, index) {
|
||||
return _buildCommunityTile(context, state.communities[index]);
|
||||
},
|
||||
),
|
||||
if (state.status == CommunitiesStatus.loading &&
|
||||
state.communities.isNotEmpty)
|
||||
ColoredBox(
|
||||
color: Colors.white.withValues(alpha: 0.7),
|
||||
child: const Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ class _SpaceManagementSidebarCommunitiesListState
|
||||
void _onScroll() {
|
||||
if (_scrollController.position.pixels >=
|
||||
_scrollController.position.maxScrollExtent - 100) {
|
||||
// Trigger pagination when user is close to the bottom
|
||||
if (widget.hasNext && !widget.isLoadingMore && widget.onLoadMore != null) {
|
||||
widget.onLoadMore!();
|
||||
}
|
||||
@ -67,7 +66,6 @@ class _SpaceManagementSidebarCommunitiesListState
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Calculate item count including loading indicator
|
||||
final itemCount = widget.communities.length + (widget.isLoadingMore ? 1 : 0);
|
||||
|
||||
return SingleChildScrollView(
|
||||
|
Reference in New Issue
Block a user