mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
added loading widget, till spaces are valid
This commit is contained in:
@ -53,6 +53,9 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is SpaceManagementLoading) {
|
if (state is SpaceManagementLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
if (state is SpaceManagementInitial) {
|
||||||
|
return const Center(child: CircularProgressIndicator());
|
||||||
} else if (state is BlankState) {
|
} else if (state is BlankState) {
|
||||||
return LoadedSpaceView(
|
return LoadedSpaceView(
|
||||||
communities: state.communities,
|
communities: state.communities,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_event.dart';
|
|
||||||
import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart';
|
import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_event.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_event.dart';
|
||||||
|
@ -2,10 +2,10 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/common/widgets/empty_search_result_widget.dart';
|
|
||||||
import 'package:syncrow_web/common/widgets/search_bar.dart';
|
import 'package:syncrow_web/common/widgets/search_bar.dart';
|
||||||
import 'package:syncrow_web/common/widgets/sidebar_communities_list.dart';
|
import 'package:syncrow_web/common/widgets/sidebar_communities_list.dart';
|
||||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_state.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_event.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_event.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart';
|
||||||
@ -114,46 +114,48 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
|||||||
return Container(
|
return Container(
|
||||||
width: _width,
|
width: _width,
|
||||||
decoration: subSectionContainerDecoration,
|
decoration: subSectionContainerDecoration,
|
||||||
child: Column(
|
child: spaceTreeState is SpaceTreeLoadingState
|
||||||
mainAxisSize: MainAxisSize.min,
|
? const Center(child: CircularProgressIndicator())
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
: Column(
|
||||||
children: [
|
mainAxisSize: MainAxisSize.min,
|
||||||
SidebarHeader(onAddCommunity: _onAddCommunity),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
CustomSearchBar(
|
children: [
|
||||||
onSearchChanged: _onSearchChanged,
|
SidebarHeader(onAddCommunity: _onAddCommunity),
|
||||||
),
|
CustomSearchBar(
|
||||||
const SizedBox(height: 16),
|
onSearchChanged: _onSearchChanged,
|
||||||
Expanded(
|
),
|
||||||
child: Builder(
|
const SizedBox(height: 16),
|
||||||
builder: (_) {
|
Expanded(
|
||||||
return SidebarCommunitiesList(
|
child: Builder(
|
||||||
scrollController: _scrollController,
|
builder: (_) {
|
||||||
onScrollToEnd: () {},
|
return SidebarCommunitiesList(
|
||||||
communities: filteredCommunities,
|
scrollController: _scrollController,
|
||||||
itemBuilder: (context, index) {
|
onScrollToEnd: () {},
|
||||||
if (index == filteredCommunities.length) {
|
communities: filteredCommunities,
|
||||||
final spaceTreeState = context.read<SpaceTreeBloc>().state;
|
itemBuilder: (context, index) {
|
||||||
if (spaceTreeState.paginationIsLoading) {
|
if (index == filteredCommunities.length) {
|
||||||
return const Padding(
|
final spaceTreeState = context.read<SpaceTreeBloc>().state;
|
||||||
padding: EdgeInsets.all(8.0),
|
if (spaceTreeState.paginationIsLoading) {
|
||||||
child: Center(child: CircularProgressIndicator()),
|
return const Padding(
|
||||||
);
|
padding: EdgeInsets.all(8.0),
|
||||||
} else {
|
child: Center(child: CircularProgressIndicator()),
|
||||||
return const SizedBox.shrink();
|
);
|
||||||
}
|
} else {
|
||||||
}
|
return const SizedBox.shrink();
|
||||||
return _buildCommunityTile(context, filteredCommunities[index]);
|
}
|
||||||
},
|
}
|
||||||
);
|
return _buildCommunityTile(context, filteredCommunities[index]);
|
||||||
},
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (spaceTreeState.paginationIsLoading || spaceTreeState.isSearching)
|
||||||
|
Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
if (spaceTreeState.paginationIsLoading)
|
|
||||||
Center(
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user