mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-21 05:51:10 +08:00
lib
@ -1,3 +1,4 @@
|
||||
import 'dart:collection';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
@ -497,8 +498,8 @@ class NotesFolderFS with NotesFolderNotifier implements NotesFolder {
|
||||
return NotesFolderConfig.fromSettings(this, settings);
|
||||
}
|
||||
|
||||
Set<String> getNoteTagsRecursively() {
|
||||
return _fetchTags(this, {});
|
||||
SplayTreeSet<String> getNoteTagsRecursively() {
|
||||
return _fetchTags(this, SplayTreeSet<String>());
|
||||
}
|
||||
|
||||
Future<List<Note>> matchNotes(NoteMatcherAsync pred) async {
|
||||
@ -527,7 +528,7 @@ class NotesFolderFS with NotesFolderNotifier implements NotesFolder {
|
||||
|
||||
typedef NoteMatcherAsync = Future<bool> Function(Note n);
|
||||
|
||||
Set<String> _fetchTags(NotesFolder folder, Set<String> tags) {
|
||||
SplayTreeSet<String> _fetchTags(NotesFolder folder, SplayTreeSet<String> tags) {
|
||||
for (var note in folder.notes) {
|
||||
tags.addAll(note.tags);
|
||||
tags.addAll(note.inlineTags);
|
||||
|
@ -1,5 +1,3 @@
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
@ -21,13 +19,12 @@ class TagListingScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
var rootFolder = Provider.of<NotesFolderFS>(context);
|
||||
var allTags = rootFolder.getNoteTagsRecursively();
|
||||
var allTagsSorted = SplayTreeSet<String>.from(allTags);
|
||||
|
||||
Widget body;
|
||||
if (allTagsSorted.isNotEmpty) {
|
||||
if (allTags.isNotEmpty) {
|
||||
body = ListView(
|
||||
children: <Widget>[
|
||||
for (var tag in allTagsSorted) _buildTagTile(context, tag),
|
||||
for (var tag in allTags) _buildTagTile(context, tag),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user