Skip to content

Commit 917a504

Browse files
committed
fix multiple time tag declare issue
1 parent 3593394 commit 917a504

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

lib/Api/event_handler_api.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class EventHandlerApi {
100100
for (var hash in newTorrentList.keys) {
101101
try {
102102
TorrentModel torrentModel = TorrentModel.fromJson(newTorrentList[hash]);
103+
torrentModel.tags = torrentModel.tags.toSet().toList();
103104
torrentList.add(torrentModel);
104105
} catch (e) {
105106
print(e.toString());

lib/Components/add_tag_dialogue.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class _AddTagDialogueState extends State<AddTagDialogue>
2323
bool _showdropdown = false;
2424
late TextEditingController _textController;
2525
int _itemsVisibleInDropdown = 1;
26-
Set<String> _inputTagList = {};
26+
List<String> _inputTagList = [];
2727
Map<String, bool> _existingTags = {};
2828
Map<String, bool> _newEnterdTags = {};
2929
late Animation _animation;
@@ -35,9 +35,9 @@ class _AddTagDialogueState extends State<AddTagDialogue>
3535
void initState() {
3636
super.initState();
3737
_textController =
38-
TextEditingController(text: widget.torrents[0].tags.toSet().join(","));
38+
TextEditingController(text: widget.torrents[0].tags.join(","));
3939
_textController.addListener(_handleControllerChanged);
40-
_inputTagList = _textController.text.split(',').toSet();
40+
_inputTagList = _textController.text.split(',');
4141
}
4242

4343
@override
@@ -342,7 +342,7 @@ class _AddTagDialogueState extends State<AddTagDialogue>
342342
setState(() {
343343
_textController.text = '';
344344
_existingTags.updateAll((key, value) => value = false);
345-
_inputTagList = {};
345+
_inputTagList = [];
346346
_newEnterdTags = {};
347347
});
348348
}
@@ -356,7 +356,7 @@ class _AddTagDialogueState extends State<AddTagDialogue>
356356
_textController.selection = TextSelection.fromPosition(
357357
TextPosition(offset: _textController.text.length));
358358
}
359-
_inputTagList = _textController.text.split(',').toSet();
359+
_inputTagList = _textController.text.split(',');
360360
_inputTagList.remove("");
361361

362362
//if user press Untagged

lib/Components/torrent_tile.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ class _TorrentTileState extends State<TorrentTile> {
205205
elevation: 0,
206206
expandedColor: ThemeProvider.theme.primaryColor,
207207
baseColor: ThemeProvider.theme.primaryColor,
208+
expandedTextColor:
209+
ThemeProvider.theme.colorScheme.secondary,
208210
title: ListTile(
209211
key: Key(widget.model.hash),
210212
contentPadding: EdgeInsets.all(0),
@@ -440,7 +442,6 @@ class _TorrentTileState extends State<TorrentTile> {
440442
child: Text(
441443
(widget.model.tags.length != 0)
442444
? widget.model.tags
443-
.toSet()
444445
.toList()
445446
.toString()
446447
: 'None'),

lib/Pages/torrent_screen.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class _TorrentScreenState extends State<TorrentScreen> {
3434
filterModel.filterStatus.toString().split(".").last) ||
3535
torrent.trackerURIs.contains(filterModel.trackerURISelected) ||
3636
torrent.tags.contains(filterModel.tagSelected) ||
37-
filterModel.filterStatus.toString().split(".").last == "all") {
37+
filterModel.filterStatus.toString().split(".").last == "all" ||
38+
torrent.tags.isEmpty && filterModel.tagSelected == "Untagged") {
3839
if (torrent.name.toLowerCase().contains(keyword.toLowerCase())) {
3940
showTorrentCount++;
4041
}

0 commit comments

Comments
 (0)