diff --git a/assets/icons/edit_space.svg b/assets/icons/edit_space.svg
new file mode 100644
index 00000000..417cd5bd
--- /dev/null
+++ b/assets/icons/edit_space.svg
@@ -0,0 +1,22 @@
+
diff --git a/lib/pages/common/buttons/default_button.dart b/lib/pages/common/buttons/default_button.dart
index 4aa748b7..ecca6138 100644
--- a/lib/pages/common/buttons/default_button.dart
+++ b/lib/pages/common/buttons/default_button.dart
@@ -19,12 +19,14 @@ class DefaultButton extends StatelessWidget {
this.padding,
this.borderColor,
this.elevation,
+ this.borderWidth = 1.0,
});
final void Function()? onPressed;
final Widget child;
final double? height;
final bool isSecondary;
final double? borderRadius;
+ final double borderWidth;
final bool enabled;
final double? padding;
final bool isDone;
@@ -66,13 +68,16 @@ class DefaultButton extends StatelessWidget {
}),
shape: WidgetStateProperty.all(
RoundedRectangleBorder(
- side: BorderSide(color: borderColor ?? Colors.transparent),
+ side: BorderSide(
+ color: borderColor ?? Colors.transparent,
+ width: borderWidth,
+ ),
borderRadius: BorderRadius.circular(borderRadius ?? 20),
),
),
fixedSize: height != null
- ? WidgetStateProperty.all(Size.fromHeight(height!))
- : null,
+ ? WidgetStateProperty.all(Size.fromHeight(height!))
+ : null,
padding: WidgetStateProperty.all(
EdgeInsets.all(padding ?? 10),
),
diff --git a/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_action_button.dart b/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_action_button.dart
new file mode 100644
index 00000000..66bfe943
--- /dev/null
+++ b/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_action_button.dart
@@ -0,0 +1,59 @@
+import 'package:flutter/material.dart';
+import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart';
+import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/community_structure_header_button.dart';
+import 'package:syncrow_web/utils/color_manager.dart';
+import 'package:syncrow_web/utils/constants/assets.dart';
+
+class CommunityStructureHeaderActionButtons extends StatelessWidget {
+ const CommunityStructureHeaderActionButtons({
+ super.key,
+ required this.theme,
+ required this.isSave,
+ required this.onSave,
+ required this.onDelete,
+ required this.selectedSpace,
+ });
+
+ final ThemeData theme;
+ final bool isSave;
+ final VoidCallback onSave;
+ final VoidCallback onDelete;
+ final SpaceModel? selectedSpace;
+
+ @override
+ Widget build(BuildContext context) {
+ final canShowActions = selectedSpace != null &&
+ selectedSpace?.status != SpaceStatus.deleted &&
+ selectedSpace?.status != SpaceStatus.parentDeleted;
+
+ return Wrap(
+ alignment: WrapAlignment.end,
+ spacing: 10,
+ children: [
+ if (isSave)
+ CommunityStructureHeaderButton(
+ label: "Save",
+ icon: const Icon(Icons.save,
+ size: 18, color: ColorsManager.spaceColor),
+ onPressed: onSave,
+ theme: theme,
+ ),
+ if (canShowActions) ...[
+ CommunityStructureHeaderButton(
+ label: "Edit",
+ svgAsset: Assets.editSpace,
+ onPressed: () => {},
+ theme: theme,
+ ),
+ CommunityStructureHeaderButton(
+ label: "Delete",
+ icon: const Icon(Icons.delete,
+ size: 18, color: ColorsManager.warningRed),
+ onPressed: onDelete,
+ theme: theme,
+ ),
+ ],
+ ],
+ );
+ }
+}
diff --git a/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_button.dart b/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_button.dart
new file mode 100644
index 00000000..4388c965
--- /dev/null
+++ b/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_button.dart
@@ -0,0 +1,65 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+import 'package:syncrow_web/pages/common/buttons/default_button.dart';
+import 'package:syncrow_web/utils/color_manager.dart';
+
+class CommunityStructureHeaderButton extends StatelessWidget {
+ const CommunityStructureHeaderButton({
+ super.key,
+ required this.label,
+ this.icon,
+ required this.onPressed,
+ this.svgAsset,
+ required this.theme,
+ });
+
+ final String label;
+ final Widget? icon;
+ final VoidCallback onPressed;
+ final String? svgAsset;
+ final ThemeData theme;
+
+ @override
+ Widget build(BuildContext context) {
+ const double buttonHeight = 40;
+ return ConstrainedBox(
+ constraints: const BoxConstraints(
+ maxWidth: 100,
+ minHeight: buttonHeight,
+ ),
+ child: DefaultButton(
+ onPressed: onPressed,
+ borderWidth: 3,
+ backgroundColor: ColorsManager.textFieldGreyColor,
+ foregroundColor: ColorsManager.blackColor,
+ borderRadius: 12.0,
+ padding: 2.0,
+ height: buttonHeight,
+ elevation: 0,
+ borderColor: ColorsManager.lightGrayColor,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ if (icon != null) icon!,
+ if (svgAsset != null)
+ SvgPicture.asset(
+ svgAsset!,
+ width: 30,
+ height: 30,
+ ),
+ const SizedBox(width: 10),
+ Flexible(
+ child: Text(
+ label,
+ style: theme.textTheme.bodySmall
+ ?.copyWith(color: ColorsManager.blackColor, fontSize: 14),
+ overflow: TextOverflow.ellipsis,
+ maxLines: 1,
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_widget.dart
index 02d3819a..18f7b340 100644
--- a/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_widget.dart
+++ b/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_widget.dart
@@ -1,8 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
-import 'package:syncrow_web/pages/common/buttons/default_button.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart';
+import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/community_structure_header_action_button.dart';
+import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/community_structure_header_button.dart';
import 'package:syncrow_web/pages/spaces_management/create_community/view/create_community_dialog.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
@@ -141,70 +142,11 @@ class _CommunityStructureHeaderState extends State {
),
),
const SizedBox(width: 8),
- _buildActionButtons(theme),
+ CommunityStructureHeaderActionButtons(theme),
],
),
],
);
}
- Widget _buildActionButtons(ThemeData theme) {
- return Wrap(
- alignment: WrapAlignment.end,
- spacing: 10,
- children: [
- if (widget.isSave)
- _buildButton(
- label: "Save",
- icon: const Icon(Icons.save,
- size: 18, color: ColorsManager.spaceColor),
- onPressed: widget.onSave,
- theme: theme),
- if(widget.selectedSpace!= null)
- _buildButton(
- label: "Delete",
- icon: const Icon(Icons.delete,
- size: 18, color: ColorsManager.warningRed),
- onPressed: widget.onDelete,
- theme: theme),
- ],
- );
- }
-
- Widget _buildButton(
- {required String label,
- required Widget icon,
- required VoidCallback onPressed,
- required ThemeData theme}) {
- const double buttonHeight = 30;
- return ConstrainedBox(
- constraints: BoxConstraints(maxWidth: 80, minHeight: buttonHeight),
- child: DefaultButton(
- onPressed: onPressed,
- backgroundColor: ColorsManager.textFieldGreyColor,
- foregroundColor: ColorsManager.blackColor,
- borderRadius: 8.0,
- padding: 2.0,
- height: buttonHeight,
- elevation: 0,
- borderColor: ColorsManager.lightGrayColor,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- icon,
- const SizedBox(width: 5),
- Flexible(
- child: Text(
- label,
- style: theme.textTheme.bodySmall
- ?.copyWith(color: ColorsManager.blackColor),
- overflow: TextOverflow.ellipsis,
- maxLines: 1,
- ),
- ),
- ],
- ),
- ),
- );
- }
}
diff --git a/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart
index da67e6ed..7dc221a7 100644
--- a/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart
+++ b/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart
@@ -199,9 +199,11 @@ class _SidebarWidgetState extends State {
},
children: hasChildren
? community.spaces
+ .where((space) => (space.status != SpaceStatus.deleted ||
+ space.status != SpaceStatus.parentDeleted))
.map((space) => _buildSpaceTile(space, community))
.toList()
- : null, // Render spaces within the community
+ : null,
);
}
diff --git a/lib/pages/spaces_management/space_model/bloc/create_space_model_bloc.dart b/lib/pages/spaces_management/space_model/bloc/create_space_model_bloc.dart
index 0ba36d3b..740ff832 100644
--- a/lib/pages/spaces_management/space_model/bloc/create_space_model_bloc.dart
+++ b/lib/pages/spaces_management/space_model/bloc/create_space_model_bloc.dart
@@ -135,7 +135,8 @@ class CreateSpaceModelBloc
final updatedSpace =
currentState.space.copyWith(subspaceModels: updatedSubspaces);
- emit(CreateSpaceModelLoaded(updatedSpace,errorMessage: currentState.errorMessage));
+ emit(CreateSpaceModelLoaded(updatedSpace,
+ errorMessage: currentState.errorMessage));
} else {
emit(CreateSpaceModelError("Space template not initialized"));
}
@@ -217,8 +218,8 @@ class CreateSpaceModelBloc
if (prevSubspaces != null || newSubspaces != null) {
if (prevSubspaces != null && newSubspaces != null) {
- for (var prevSubspace in prevSubspaces!) {
- final existsInNew = newSubspaces!
+ for (var prevSubspace in prevSubspaces) {
+ final existsInNew = newSubspaces
.any((newTag) => newTag.uuid == prevSubspace.uuid);
if (!existsInNew) {
subspaceUpdates.add(UpdateSubspaceTemplateModel(
@@ -260,9 +261,20 @@ class CreateSpaceModelBloc
for (var subspace in newSubspaces!) subspace.uuid: subspace
};
- for (var prevSubspace in prevSubspaces!) {
+ for (var prevSubspace in prevSubspaces) {
final newSubspace = newSubspaceMap[prevSubspace.uuid];
+
if (newSubspace != null) {
+ if(prevSubspace.tags!=null){
+ for(var t in prevSubspace.tags!){
+ print("old tags are ${t.tag} ${t.uuid}");
+ }}
+
+ if(newSubspace.tags!=null){
+ for(var t in newSubspace.tags!){
+ print("new tags are ${t.tag} ${t.uuid}");
+ }}
+
final List tagSubspaceUpdates =
processTagUpdates(prevSubspace.tags, newSubspace.tags);
subspaceUpdates.add(UpdateSubspaceTemplateModel(
@@ -270,7 +282,7 @@ class CreateSpaceModelBloc
uuid: newSubspace.uuid,
subspaceName: newSubspace.subspaceName,
tags: tagSubspaceUpdates));
- } else {}
+ }
}
}
}
diff --git a/lib/utils/constants/assets.dart b/lib/utils/constants/assets.dart
index a9deb3c7..b151890a 100644
--- a/lib/utils/constants/assets.dart
+++ b/lib/utils/constants/assets.dart
@@ -259,6 +259,7 @@ class Assets {
static const String delete = 'assets/icons/delete.svg';
static const String edit = 'assets/icons/edit.svg';
+ static const String editSpace = 'assets/icons/edit_space.svg';
//assets/icons/routine/tab_to_run.svg
static const String tabToRun = 'assets/icons/routine/tab_to_run.svg';