rename tag

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages committed 2023-08-10 10:35:46 +08:00
1 parent 46b3cf1871
commit db45552a05
38 files changed
+204 -63

No files matched your search

+27
View File
@@ -223,6 +223,33 @@ class AbModel {
}
}
void renameTag(String oldTag, String newTag) {
if (tags.contains(newTag)) return;
tags.value = tags.map((e) {
if (e == oldTag) {
return newTag;
} else {
return oldTag;
}
}).toList();
selectedTags.value = selectedTags.map((e) {
if (e == oldTag) {
return newTag;
} else {
return oldTag;
}
}).toList();
for (var peer in peers) {
peer.tags = peer.tags.map((e) {
if (e == oldTag) {
return newTag;
} else {
return oldTag;
}
}).toList();
}
}
void unsetSelectedTags() {
selectedTags.clear();
}