Skip to content

Commit

Permalink
Transaction: Reset Tag search when all shown tags are selected
Browse files Browse the repository at this point in the history
fixes #171
  • Loading branch information
dreautall committed Oct 14, 2023
1 parent 38a221f commit 89cc851
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/pages/transaction/tags.dart
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,12 @@ class _TagDialogState extends State<TagDialog> {
),
const Divider(),
];
for (String tag in allTags) {
final Iterable<String> filteredTags = allTags.where(
(String t) =>
_newTagTextController.text.isEmpty ||
(_newTagTextController.text.isNotEmpty &&
t.containsIgnoreCase(_newTagTextController.text)));
for (String tag in filteredTags) {
if (_newTagTextController.text.isNotEmpty &&
!tag.containsIgnoreCase(_newTagTextController.text)) {
continue;
Expand All @@ -281,6 +286,12 @@ class _TagDialogState extends State<TagDialog> {
} else if ((selected != null && selected) &&
!_newSelectedTags.containsIgnoreCase(tag)) {
_newSelectedTags.add(tag);
if (filteredTags
.where((String t) =>
!_newSelectedTags.containsIgnoreCase(t))
.isEmpty) {
_newTagTextController.text = "";
}
}
},
);
Expand Down

0 comments on commit 89cc851

Please sign in to comment.