mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Fixed issue in loading space model
This commit is contained in:
@ -87,6 +87,7 @@ class SpaceManagementBloc
|
|||||||
prevSpaceModels = List<SpaceTemplateModel>.from(
|
prevSpaceModels = List<SpaceTemplateModel>.from(
|
||||||
(previousState as dynamic).spaceModels ?? [],
|
(previousState as dynamic).spaceModels ?? [],
|
||||||
);
|
);
|
||||||
|
allSpaces.addAll(prevSpaceModels);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prevSpaceModels.isEmpty) {
|
if (prevSpaceModels.isEmpty) {
|
||||||
@ -273,6 +274,8 @@ class SpaceManagementBloc
|
|||||||
await _api.createCommunity(event.name, event.description);
|
await _api.createCommunity(event.name, event.description);
|
||||||
var prevSpaceModels = await fetchSpaceModels(previousState);
|
var prevSpaceModels = await fetchSpaceModels(previousState);
|
||||||
|
|
||||||
|
print("space models are ${prevSpaceModels}");
|
||||||
|
|
||||||
if (newCommunity != null) {
|
if (newCommunity != null) {
|
||||||
if (previousState is SpaceManagementLoaded ||
|
if (previousState is SpaceManagementLoaded ||
|
||||||
previousState is BlankState) {
|
previousState is BlankState) {
|
||||||
@ -314,7 +317,6 @@ class SpaceManagementBloc
|
|||||||
SelectSpaceEvent event,
|
SelectSpaceEvent event,
|
||||||
Emitter<SpaceManagementState> emit,
|
Emitter<SpaceManagementState> emit,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
_handleCommunitySpaceStateUpdate(
|
_handleCommunitySpaceStateUpdate(
|
||||||
emit: emit,
|
emit: emit,
|
||||||
selectedCommunity: event.selectedCommunity,
|
selectedCommunity: event.selectedCommunity,
|
||||||
|
@ -43,6 +43,7 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
|
|||||||
rightBody: const NavigateHomeGridView(),
|
rightBody: const NavigateHomeGridView(),
|
||||||
scaffoldBody: BlocBuilder<SpaceManagementBloc, SpaceManagementState>(
|
scaffoldBody: BlocBuilder<SpaceManagementBloc, SpaceManagementState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
|
print("current state is ${state}");
|
||||||
if (state is SpaceManagementLoading) {
|
if (state is SpaceManagementLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
} else if (state is BlankState) {
|
} else if (state is BlankState) {
|
||||||
|
@ -83,8 +83,13 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
|||||||
widget.selectedProducts.isNotEmpty ? widget.selectedProducts : [];
|
widget.selectedProducts.isNotEmpty ? widget.selectedProducts : [];
|
||||||
isOkButtonEnabled =
|
isOkButtonEnabled =
|
||||||
enteredName.isNotEmpty || nameController.text.isNotEmpty;
|
enteredName.isNotEmpty || nameController.text.isNotEmpty;
|
||||||
tags = widget.tags ?? [];
|
if (widget.currentSpaceModel != null) {
|
||||||
subspaces = widget.subspaces ?? [];
|
subspaces = [];
|
||||||
|
tags = [];
|
||||||
|
} else {
|
||||||
|
tags = widget.tags ?? [];
|
||||||
|
subspaces = widget.subspaces ?? [];
|
||||||
|
}
|
||||||
selectedSpaceModel = widget.currentSpaceModel;
|
selectedSpaceModel = widget.currentSpaceModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,8 +666,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
|||||||
|
|
||||||
void _showTagCreateDialog(BuildContext context, String name, bool isEdit,
|
void _showTagCreateDialog(BuildContext context, String name, bool isEdit,
|
||||||
List<ProductModel>? products) {
|
List<ProductModel>? products) {
|
||||||
|
print("ada ${widget.allTags}");
|
||||||
print("ada ${widget.allTags}");
|
|
||||||
isEdit
|
isEdit
|
||||||
? showDialog(
|
? showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
Reference in New Issue
Block a user