fix(learn): Archived and Recently deleted fold during a search
A search opened both sections whatever they were set to, so a tap on their headers did nothing while one was under way. A search still opens them, so their matches show, and a tap now folds them until the search ends, which brings them back as they were left before it. Whats-New: While searching the library, Archived and Recently deleted fold again when tapped. Whats-New-De: Beim Suchen in der Bibliothek lassen sich Archiviert und Zuletzt gelöscht wieder einklappen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
9b344141ef
commit
3ee29de391
1 changed files with 62 additions and 6 deletions
|
|
@ -494,6 +494,20 @@ class _GridState() extends State<_Grid> {
|
|||
var _archiveOpen = false;
|
||||
var _deletedOpen = true;
|
||||
|
||||
/// Whether the sections are open during a search: each search opens
|
||||
/// them, so their matches show, and a tap folds them until it ends.
|
||||
var _archiveOpenInSearch = true;
|
||||
var _deletedOpenInSearch = true;
|
||||
|
||||
@override
|
||||
void didUpdateWidget(_Grid oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.query.isEmpty && widget.query.isNotEmpty) {
|
||||
_archiveOpenInSearch = true;
|
||||
_deletedOpenInSearch = true;
|
||||
}
|
||||
}
|
||||
|
||||
static const _spacing = 12.0;
|
||||
|
||||
// As many columns as fit cards up to 400 dp wide; every card as tall, so
|
||||
|
|
@ -594,10 +608,11 @@ class _GridState() extends State<_Grid> {
|
|||
for (final studyset in widget.deleted)
|
||||
if (listed(studyset)) studyset,
|
||||
];
|
||||
// A search opens the sections, so their matches show; closing the
|
||||
// search brings them back as the person left them.
|
||||
final archiveOpen = searching || _archiveOpen;
|
||||
final deletedOpen = searching || _deletedOpen;
|
||||
// A search opens the sections, so their matches show, and a tap folds
|
||||
// them for the rest of it; closing the search brings them back as the
|
||||
// person left them.
|
||||
final archiveOpen = searching ? _archiveOpenInSearch : _archiveOpen;
|
||||
final deletedOpen = searching ? _deletedOpenInSearch : _deletedOpen;
|
||||
// Pulled down, the library syncs.
|
||||
return AppRefreshIndicator(
|
||||
onRefresh: () => _syncNow(context),
|
||||
|
|
@ -655,7 +670,13 @@ class _GridState() extends State<_Grid> {
|
|||
label: l10n.libraryArchivedSection,
|
||||
count: archived.length,
|
||||
open: archiveOpen,
|
||||
onToggle: () => setState(() => _archiveOpen = !_archiveOpen),
|
||||
onToggle: () => setState(() {
|
||||
if (searching) {
|
||||
_archiveOpenInSearch = !_archiveOpenInSearch;
|
||||
} else {
|
||||
_archiveOpen = !_archiveOpen;
|
||||
}
|
||||
}),
|
||||
),
|
||||
),
|
||||
if (archiveOpen)
|
||||
|
|
@ -680,7 +701,13 @@ class _GridState() extends State<_Grid> {
|
|||
label: l10n.libraryDeletedSection,
|
||||
count: deleted.length,
|
||||
open: deletedOpen,
|
||||
onToggle: () => setState(() => _deletedOpen = !_deletedOpen),
|
||||
onToggle: () => setState(() {
|
||||
if (searching) {
|
||||
_deletedOpenInSearch = !_deletedOpenInSearch;
|
||||
} else {
|
||||
_deletedOpen = !_deletedOpen;
|
||||
}
|
||||
}),
|
||||
),
|
||||
),
|
||||
if (deletedOpen) ...[
|
||||
|
|
|
|||
Loading…
Reference in a new issue