mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
updated LoadedSpaceView
This commit is contained in:
@ -36,32 +36,22 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
SpaceManagementBloc(_api, _productApi)..add(LoadCommunityAndSpacesEvent()),
|
||||
create: (context) => SpaceManagementBloc(_api, _productApi)
|
||||
..add(LoadCommunityAndSpacesEvent()),
|
||||
child: WebScaffold(
|
||||
appBarTitle: Text('Space Management', style: Theme.of(context).textTheme.headlineLarge),
|
||||
appBarTitle: Text('Space Management',
|
||||
style: Theme.of(context).textTheme.headlineLarge),
|
||||
enableMenuSidebar: false,
|
||||
rightBody: const NavigateHomeGridView(),
|
||||
scaffoldBody:
|
||||
BlocBuilder<SpaceManagementBloc, SpaceManagementState>(builder: (context, state) {
|
||||
scaffoldBody: BlocBuilder<SpaceManagementBloc, SpaceManagementState>(
|
||||
builder: (context, state) {
|
||||
if (state is SpaceManagementLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (state is SpaceManagementLoaded) {
|
||||
int selectedIndex = state.communities.indexWhere(
|
||||
(community) => community.uuid == selectedCommunity?.uuid,
|
||||
);
|
||||
if (selectedIndex != -1) {
|
||||
selectedCommunity = state.communities[selectedIndex];
|
||||
} else if (state.selectedCommunity != null) {
|
||||
selectedCommunity = state.selectedCommunity;
|
||||
} else {
|
||||
selectedCommunity = null;
|
||||
selectedSpace = null;
|
||||
}
|
||||
return LoadedSpaceView(
|
||||
communities: state.communities,
|
||||
selectedCommunity: selectedCommunity,
|
||||
selectedSpace: selectedSpace,
|
||||
selectedCommunity: state.selectedCommunity,
|
||||
selectedSpace: state.selectedSpace,
|
||||
products: state.products,
|
||||
onCommunitySelected: (community) {
|
||||
setState(() {
|
||||
|
Reference in New Issue
Block a user