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), communities: List<CommunityModel>.from(prevCommunities),
products: _cachedProducts ?? [], products: _cachedProducts ?? [],
spaceModels: prevSpaceModels, spaceModels: prevSpaceModels,
allTags: _cachedTags)); allTags: _cachedTags ?? []));
return; return;
} }

View File

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

View File

@ -60,7 +60,7 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
selectedSpace: null, selectedSpace: null,
products: state.products, products: state.products,
shouldNavigateToSpaceModelPage: false, shouldNavigateToSpaceModelPage: false,
projectTags: state.allTags,
); );
} else if (state is SpaceManagementLoaded) { } else if (state is SpaceManagementLoaded) {
return LoadedSpaceView( return LoadedSpaceView(
@ -70,6 +70,7 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
products: state.products, products: state.products,
spaceModels: state.spaceModels, spaceModels: state.spaceModels,
shouldNavigateToSpaceModelPage: false, shouldNavigateToSpaceModelPage: false,
projectTags: state.allTags,
); );
} else if (state is SpaceModelLoaded) { } else if (state is SpaceModelLoaded) {
return LoadedSpaceView( return LoadedSpaceView(
@ -77,6 +78,7 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
products: state.products, products: state.products,
spaceModels: state.spaceModels, spaceModels: state.spaceModels,
shouldNavigateToSpaceModelPage: true, shouldNavigateToSpaceModelPage: true,
projectTags: state.allTags,
); );
} else if (state is SpaceManagementError) { } else if (state is SpaceManagementError) {
return Center(child: Text('Error: ${state.errorMessage}')); 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/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/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/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/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/gradient_canvas_border_widget.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/sidebar_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<ProductModel>? products;
final List<SpaceTemplateModel>? spaceModels; final List<SpaceTemplateModel>? spaceModels;
final bool shouldNavigateToSpaceModelPage; final bool shouldNavigateToSpaceModelPage;
final List<Tag> projectTags;
const LoadedSpaceView({ const LoadedSpaceView(
super.key, {super.key,
required this.communities, required this.communities,
this.selectedCommunity, this.selectedCommunity,
this.selectedSpace, this.selectedSpace,
this.products, this.products,
this.spaceModels, this.spaceModels,
required this.shouldNavigateToSpaceModelPage, required this.shouldNavigateToSpaceModelPage,
}); required this.projectTags});
@override @override
_LoadedSpaceViewState createState() => _LoadedSpaceViewState(); _LoadedSpaceViewState createState() => _LoadedSpaceViewState();
@ -81,8 +83,7 @@ class _LoadedSpaceViewState extends State<LoadedSpaceView> {
? _spaceModels.isNotEmpty ? _spaceModels.isNotEmpty
? Row( ? Row(
children: [ children: [
SizedBox( SizedBox(width: 300, child: SpaceTreeView(onSelect: () {})),
width: 300, child: SpaceTreeView(onSelect: () {})),
Expanded( Expanded(
child: BlocProvider( child: BlocProvider(
create: (context) => SpaceModelBloc( create: (context) => SpaceModelBloc(
@ -92,6 +93,7 @@ class _LoadedSpaceViewState extends State<LoadedSpaceView> {
child: SpaceModelPage( child: SpaceModelPage(
products: widget.products, products: widget.products,
onSpaceModelsUpdated: _onSpaceModelsUpdated, onSpaceModelsUpdated: _onSpaceModelsUpdated,
projectTags: widget.projectTags,
), ),
), ),
), ),
@ -102,9 +104,8 @@ class _LoadedSpaceViewState extends State<LoadedSpaceView> {
children: [ children: [
SidebarWidget( SidebarWidget(
communities: widget.communities, communities: widget.communities,
selectedSpaceUuid: widget.selectedSpace?.uuid ?? selectedSpaceUuid:
widget.selectedCommunity?.uuid ?? widget.selectedSpace?.uuid ?? widget.selectedCommunity?.uuid ?? '',
'',
), ),
CommunityStructureArea( CommunityStructureArea(
selectedCommunity: widget.selectedCommunity, selectedCommunity: widget.selectedCommunity,

View File

@ -1,6 +1,7 @@
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/spaces_management/all_spaces/model/product_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/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_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/bloc/space_model_state.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.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 { class SpaceModelPage extends StatelessWidget {
final List<ProductModel>? products; final List<ProductModel>? products;
final Function(List<SpaceTemplateModel>)? onSpaceModelsUpdated; 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); : super(key: key);
@override @override
@ -69,8 +71,7 @@ class SpaceModelPage extends StatelessWidget {
} }
// Render existing space model // Render existing space model
final model = spaceModels[index]; final model = spaceModels[index];
final otherModel = final otherModel = List<String>.from(allSpaceModelNames);
List<String>.from(allSpaceModelNames);
otherModel.remove(model.modelName); otherModel.remove(model.modelName);
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
@ -107,10 +108,8 @@ class SpaceModelPage extends StatelessWidget {
return Center( return Center(
child: Text( child: Text(
'Error: ${state.message}', 'Error: ${state.message}',
style: Theme.of(context) style:
.textTheme Theme.of(context).textTheme.bodySmall?.copyWith(color: ColorsManager.warningRed),
.bodySmall
?.copyWith(color: ColorsManager.warningRed),
), ),
); );
} }