passed tags to space model page

This commit is contained in:
hannathkadher
2025-03-05 17:16:00 +04:00
parent c9427b35be
commit 213ec329c0
5 changed files with 26 additions and 24 deletions

View File

@ -247,7 +247,7 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
communities: List<CommunityModel>.from(prevCommunities),
products: _cachedProducts ?? [],
spaceModels: prevSpaceModels,
allTags: _cachedTags));
allTags: _cachedTags ?? []));
return;
}

View File

@ -37,7 +37,7 @@ class BlankState extends SpaceManagementState {
final List<CommunityModel> communities;
final List<ProductModel> products;
List<SpaceTemplateModel>? spaceModels;
final List<Tag>? allTags;
final List<Tag> allTags;
BlankState(
{required this.communities, required this.products, this.spaceModels, required this.allTags});

View File

@ -60,7 +60,7 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
selectedSpace: null,
products: state.products,
shouldNavigateToSpaceModelPage: false,
projectTags: state.allTags,
);
} else if (state is SpaceManagementLoaded) {
return LoadedSpaceView(
@ -70,6 +70,7 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
products: state.products,
spaceModels: state.spaceModels,
shouldNavigateToSpaceModelPage: false,
projectTags: state.allTags,
);
} else if (state is SpaceModelLoaded) {
return LoadedSpaceView(
@ -77,6 +78,7 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
products: state.products,
spaceModels: state.spaceModels,
shouldNavigateToSpaceModelPage: true,
projectTags: state.allTags,
);
} else if (state is SpaceManagementError) {
return Center(child: Text('Error: ${state.errorMessage}'));

View File

@ -4,6 +4,7 @@ import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/community_structure_widget.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/gradient_canvas_border_widget.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart';
@ -19,16 +20,17 @@ class LoadedSpaceView extends StatefulWidget {
final List<ProductModel>? products;
final List<SpaceTemplateModel>? spaceModels;
final bool shouldNavigateToSpaceModelPage;
final List<Tag> projectTags;
const LoadedSpaceView({
super.key,
required this.communities,
this.selectedCommunity,
this.selectedSpace,
this.products,
this.spaceModels,
required this.shouldNavigateToSpaceModelPage,
});
const LoadedSpaceView(
{super.key,
required this.communities,
this.selectedCommunity,
this.selectedSpace,
this.products,
this.spaceModels,
required this.shouldNavigateToSpaceModelPage,
required this.projectTags});
@override
_LoadedSpaceViewState createState() => _LoadedSpaceViewState();
@ -81,8 +83,7 @@ class _LoadedSpaceViewState extends State<LoadedSpaceView> {
? _spaceModels.isNotEmpty
? Row(
children: [
SizedBox(
width: 300, child: SpaceTreeView(onSelect: () {})),
SizedBox(width: 300, child: SpaceTreeView(onSelect: () {})),
Expanded(
child: BlocProvider(
create: (context) => SpaceModelBloc(
@ -92,6 +93,7 @@ class _LoadedSpaceViewState extends State<LoadedSpaceView> {
child: SpaceModelPage(
products: widget.products,
onSpaceModelsUpdated: _onSpaceModelsUpdated,
projectTags: widget.projectTags,
),
),
),
@ -102,9 +104,8 @@ class _LoadedSpaceViewState extends State<LoadedSpaceView> {
children: [
SidebarWidget(
communities: widget.communities,
selectedSpaceUuid: widget.selectedSpace?.uuid ??
widget.selectedCommunity?.uuid ??
'',
selectedSpaceUuid:
widget.selectedSpace?.uuid ?? widget.selectedCommunity?.uuid ?? '',
),
CommunityStructureArea(
selectedCommunity: widget.selectedCommunity,

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/bloc/space_model_bloc.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/bloc/space_model_state.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
@ -12,8 +13,9 @@ import 'package:syncrow_web/utils/color_manager.dart';
class SpaceModelPage extends StatelessWidget {
final List<ProductModel>? products;
final Function(List<SpaceTemplateModel>)? onSpaceModelsUpdated;
final List<Tag> projectTags;
const SpaceModelPage({Key? key, this.products, this.onSpaceModelsUpdated})
const SpaceModelPage({Key? key, this.products, this.onSpaceModelsUpdated, required this.projectTags})
: super(key: key);
@override
@ -69,8 +71,7 @@ class SpaceModelPage extends StatelessWidget {
}
// Render existing space model
final model = spaceModels[index];
final otherModel =
List<String>.from(allSpaceModelNames);
final otherModel = List<String>.from(allSpaceModelNames);
otherModel.remove(model.modelName);
return GestureDetector(
onTap: () {
@ -107,10 +108,8 @@ class SpaceModelPage extends StatelessWidget {
return Center(
child: Text(
'Error: ${state.message}',
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(color: ColorsManager.warningRed),
style:
Theme.of(context).textTheme.bodySmall?.copyWith(color: ColorsManager.warningRed),
),
);
}