-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Added tag UI placeholder for future search and filtering #8396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Chithrakc99
wants to merge
1
commit into
AppFlowy-IO:main
Choose a base branch
from
Chithrakc99:feature/tag-ui-placeholder
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+149
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+988 KB
.vs/AppFlowy/FileContentIndex/520dbd8f-66b9-4c8d-b60b-2460efd374b9.vsidx
Binary file not shown.
Binary file added
BIN
+3.64 MB
.vs/AppFlowy/FileContentIndex/5ac79d46-a185-4233-8a8a-a92af82f2ae9.vsidx
Binary file not shown.
Binary file added
BIN
+4.29 MB
.vs/AppFlowy/FileContentIndex/865ffcf8-137c-4643-9b43-8bc3f8e64f63.vsidx
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "Version": 1, | ||
| "WorkspaceRootPath": "C:\\Users\\Chithra\\AppFlowy\\", | ||
| "Documents": [], | ||
| "DocumentGroupContainers": [ | ||
| { | ||
| "Orientation": 0, | ||
| "VerticalTabListWidth": 256, | ||
| "DocumentGroups": [] | ||
| } | ||
| ] | ||
| } |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "ExpandedNodes": [ | ||
| "", | ||
| "\\frontend" | ||
| ], | ||
| "SelectedNode": "\\frontend", | ||
| "PreviewInSolutionExplorer": false | ||
| } |
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
frontend/appflowy_flutter/lib/workspace/application/tag/tag.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| class Tag { | ||
| final String id; | ||
| final String name; | ||
| final int color; | ||
|
|
||
| const Tag({ | ||
| required this.id, | ||
| required this.name, | ||
| required this.color, | ||
| }); | ||
| } |
13 changes: 13 additions & 0 deletions
13
frontend/appflowy_flutter/lib/workspace/application/tag/tag_filter.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import 'tag.dart'; | ||
|
|
||
| class TagFilter { | ||
| static bool match({ | ||
| required List<Tag> tags, | ||
| required String query, | ||
| }) { | ||
| if (query.isEmpty) return true; | ||
|
|
||
| final lower = query.toLowerCase(); | ||
| return tags.any((tag) => tag.name.toLowerCase().contains(lower)); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
frontend/appflowy_flutter/lib/workspace/presentation/widgets/tags/tag_editor.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import '../../../application/tag/tag.dart'; | ||
|
|
||
| class TagEditor extends StatefulWidget { | ||
| final List<Tag> tags; | ||
| final ValueChanged<List<Tag>> onChanged; | ||
|
|
||
| const TagEditor({ | ||
| super.key, | ||
| required this.tags, | ||
| required this.onChanged, | ||
| }); | ||
|
|
||
| @override | ||
| State<TagEditor> createState() => _TagEditorState(); | ||
| } | ||
|
|
||
| class _TagEditorState extends State<TagEditor> { | ||
| final controller = TextEditingController(); | ||
|
|
||
| void _addTag(String value) { | ||
| if (value.trim().isEmpty) return; | ||
|
|
||
| widget.onChanged([ | ||
| ...widget.tags, | ||
| Tag( | ||
| id: DateTime.now().millisecondsSinceEpoch.toString(), | ||
| name: value.trim(), | ||
| color: Colors.blue.value, | ||
| ), | ||
| ]); | ||
|
|
||
| controller.clear(); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Column( | ||
| crossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| Wrap( | ||
| spacing: 6, | ||
| children: widget.tags.map((tag) { | ||
| return Chip( | ||
| label: Text(tag.name), | ||
| onDeleted: () { | ||
| widget.onChanged( | ||
| widget.tags.where((t) => t.id != tag.id).toList(), | ||
| ); | ||
| }, | ||
| ); | ||
| }).toList(), | ||
| ), | ||
| const SizedBox(height: 6), | ||
| TextField( | ||
| controller: controller, | ||
| onSubmitted: _addTag, | ||
| decoration: const InputDecoration( | ||
| hintText: 'Add tag', | ||
| isDense: true, | ||
| ), | ||
| ), | ||
| ], | ||
| ); | ||
| } | ||
| } |
25 changes: 25 additions & 0 deletions
25
frontend/appflowy_flutter/lib/workspace/presentation/widgets/tags/tag_search_bar.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| class TagSearchBar extends StatelessWidget { | ||
| final ValueChanged<String> onChanged; | ||
|
|
||
| const TagSearchBar({ | ||
| super.key, | ||
| required this.onChanged, | ||
| }); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Padding( | ||
| padding: const EdgeInsets.all(8), | ||
| child: TextField( | ||
| decoration: const InputDecoration( | ||
| hintText: 'Search by tag...', | ||
| prefixIcon: Icon(Icons.search), | ||
| border: OutlineInputBorder(), | ||
| ), | ||
| onChanged: onChanged, | ||
| ), | ||
| ); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Trimming and normalizing the query would make matching more robust.
Because the emptiness check runs before lowercasing, a query like
' 'is treated as non-empty and never matches anything. Trim and lowercase once (e.g.final normalized = query.trim().toLowerCase();) and usenormalized.isEmptyandnormalizedfor matching to handle whitespace-only queries correctly.