todo-app/lib/ui/notes_list_defaults.dart
Krzysztof kuhy Rudnicki 67212cd7ec
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
One list: repo groups, repo search, compact filter
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-02 13:40:20 +01:00

18 lines
671 B
Dart

import 'package:todo/data/note.dart';
import 'package:todo/data/note_repository.dart';
/// The default status selection: hide completed/dropped work.
const Set<Status> kDefaultStatuses = {Status.todo, Status.inProgress};
/// The notes list's unfiltered baseline, which "Clear all" resets to.
const kDefaultNoteFilter = NoteFilter(statuses: kDefaultStatuses);
/// Facets the user changed from [kDefaultNoteFilter], for the filter badge.
int userFacetCount(NoteFilter filter) {
var count = filter.activeCount;
if (_same(filter.statuses, kDefaultStatuses)) count -= 1;
return count;
}
bool _same<T>(Set<T> a, Set<T> b) => a.length == b.length && a.containsAll(b);