mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Merge pull request #83 from SyncrowIOT/bugfix/fix-issue-in-creating-space-with-duplicate
Bugfix/fix-issue-in-creating-space-with-duplicate
This commit is contained in:
@ -639,6 +639,16 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
||||
final duplicatedName =
|
||||
SpaceHelper.generateUniqueSpaceName(original.name, spaces);
|
||||
|
||||
final List<SubspaceModel>? duplicatedSubspaces;
|
||||
final List<Tag>? duplicatedTags;
|
||||
if (original.spaceModel != null) {
|
||||
duplicatedTags = [];
|
||||
duplicatedSubspaces = [];
|
||||
} else {
|
||||
duplicatedTags = original.tags;
|
||||
duplicatedSubspaces = original.subspaces;
|
||||
}
|
||||
|
||||
final duplicated = SpaceModel(
|
||||
name: duplicatedName,
|
||||
icon: original.icon,
|
||||
@ -648,8 +658,8 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
||||
status: SpaceStatus.newSpace,
|
||||
parent: duplicatedParent,
|
||||
spaceModel: original.spaceModel,
|
||||
subspaces: original.subspaces,
|
||||
tags: original.tags,
|
||||
subspaces: duplicatedSubspaces,
|
||||
tags: duplicatedTags,
|
||||
);
|
||||
|
||||
originalToDuplicate[original] = duplicated;
|
||||
|
@ -71,6 +71,7 @@ class AssignTagDialog extends StatelessWidget {
|
||||
child: DataTable(
|
||||
headingRowColor: WidgetStateProperty.all(
|
||||
ColorsManager.dataHeaderGrey),
|
||||
key: ValueKey(state.tags.length),
|
||||
border: TableBorder.all(
|
||||
color: ColorsManager.dataHeaderGrey,
|
||||
width: 1,
|
||||
@ -120,6 +121,7 @@ class AssignTagDialog extends StatelessWidget {
|
||||
final controller = controllers[index];
|
||||
final availableTags = getAvailableTags(
|
||||
allTags ?? [], state.tags, tag);
|
||||
|
||||
return DataRow(
|
||||
cells: [
|
||||
DataCell(Text((index + 1).toString())),
|
||||
@ -158,6 +160,8 @@ class AssignTagDialog extends StatelessWidget {
|
||||
.add(DeleteTag(
|
||||
tagToDelete: tag,
|
||||
tags: state.tags));
|
||||
|
||||
controllers.removeAt(index);
|
||||
},
|
||||
tooltip: 'Delete Tag',
|
||||
padding: EdgeInsets.zero,
|
||||
@ -255,6 +259,7 @@ class AssignTagDialog extends StatelessWidget {
|
||||
spaceTags: processedTags,
|
||||
isCreate: false,
|
||||
onSave: onSave,
|
||||
allTags: allTags,
|
||||
),
|
||||
);
|
||||
},
|
||||
@ -265,10 +270,10 @@ class AssignTagDialog extends StatelessWidget {
|
||||
Expanded(
|
||||
child: DefaultButton(
|
||||
borderRadius: 10,
|
||||
backgroundColor: state.isSaveEnabled
|
||||
? ColorsManager.secondaryColor
|
||||
: ColorsManager.grayColor,
|
||||
foregroundColor: ColorsManager.whiteColors,
|
||||
backgroundColor: ColorsManager.secondaryColor,
|
||||
foregroundColor: state.isSaveEnabled
|
||||
? ColorsManager.whiteColors
|
||||
: ColorsManager.whiteColorsWithOpacity,
|
||||
onPressed: state.isSaveEnabled
|
||||
? () async {
|
||||
final updatedTags = List<Tag>.from(state.tags);
|
||||
|
@ -82,6 +82,7 @@ class AssignTagModelsDialog extends StatelessWidget {
|
||||
child: DataTable(
|
||||
headingRowColor: WidgetStateProperty.all(
|
||||
ColorsManager.dataHeaderGrey),
|
||||
key: ValueKey(state.tags.length),
|
||||
border: TableBorder.all(
|
||||
color: ColorsManager.dataHeaderGrey,
|
||||
width: 1,
|
||||
@ -176,6 +177,7 @@ class AssignTagModelsDialog extends StatelessWidget {
|
||||
.add(DeleteTagModel(
|
||||
tagToDelete: tag,
|
||||
tags: state.tags));
|
||||
controllers.removeAt(index);
|
||||
},
|
||||
tooltip: 'Delete Tag',
|
||||
padding: EdgeInsets.zero,
|
||||
@ -302,10 +304,10 @@ class AssignTagModelsDialog extends StatelessWidget {
|
||||
Expanded(
|
||||
child: DefaultButton(
|
||||
borderRadius: 10,
|
||||
backgroundColor: state.isSaveEnabled
|
||||
? ColorsManager.secondaryColor
|
||||
: ColorsManager.grayColor,
|
||||
foregroundColor: ColorsManager.whiteColors,
|
||||
backgroundColor: ColorsManager.secondaryColor,
|
||||
foregroundColor: state.isSaveEnabled
|
||||
? ColorsManager.whiteColors
|
||||
: ColorsManager.whiteColorsWithOpacity,
|
||||
onPressed: state.isSaveEnabled
|
||||
? () async {
|
||||
final updatedTags =
|
||||
|
Reference in New Issue
Block a user