feat(todo): a table's columns, chosen and moved, each with its menu (ADR 0033, D36)

As Todoist's after trying it: Description and Created join the columns,
Display's Columns turns them and a task's details on and off, and a heading
filters, sorts, moves or hides its column. Sorting can run either way, and
tasks can be filtered by when they were added. Reporting's project filter
shows each project's icon.

Whats-New: Table: choose and arrange its columns, and filter, sort or hide one from its heading.
Whats-New-De: Tabelle: Wähle und ordne die Spalten und filtere, sortiere oder blende eine über ihre Überschrift aus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-06 21:05:54 +01:00
commit 977a513379
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -1085,6 +1085,121 @@ void main() {
expect(find.text('Pay rent'), findsNWidgets(2));
});
Future<void> asTable(WidgetTester tester, ProjectView view) async {
final all = await tester.runAsync(
() => ProjectRepository(projectRows, keys).all(),
);
await tester.runAsync(
() => ProjectRepository(projectRows, keys).update(
inbox(),
all!
.firstWhere((project) => project.id == inbox())
.content!
.copyWith(view: view),
),
);
projectRows.bringRemoteChanges();
tester.view.physicalSize = const Size(1400, 900);
await tester.pumpAndSettle();
}
ProjectView? kept(List<StoredProject> projects) => projects
.firstWhere((project) => project.id == inbox())
.content
?.view;
testWidgets("a heading offers what its column can do: Task can't be "
'hidden or filtered, Labels not sorted, the ends not moved '
'further', (tester) async {
await inboxOf(tester);
await asTable(
tester,
const ProjectView(layout: ProjectLayout.table),
);
await tester.tap(find.byKey(ProjectTable.columnKey(TaskColumn.task)));
await tester.pumpAndSettle();
expect(find.text('Sort ascending'), findsOneWidget);
expect(find.text('Hide column'), findsNothing);
expect(find.text('Filter'), findsNothing);
expect(
tester
.widget<PopupMenuItem<Object?>>(
find.ancestor(
of: find.text('Move left'),
matching: find.byWidgetPredicate(
(widget) => widget is PopupMenuItem,
),
),
)
.enabled,
isFalse,
);
await tester.tapAt(const Offset(700, 800));
await tester.pumpAndSettle();
await tester.tap(
find.byKey(ProjectTable.columnKey(TaskColumn.labels)),
);
await tester.pumpAndSettle();
expect(find.text('Sort ascending'), findsNothing);
expect(find.text('Filter'), findsOneWidget);
expect(find.text('Hide column'), findsOneWidget);
});
testWidgets('hiding a column and sorting from a heading are kept', (
tester,
) async {
await inboxOf(tester);
await asTable(
tester,
const ProjectView(layout: ProjectLayout.table),
);
await tester.tap(find.byKey(ProjectTable.columnKey(TaskColumn.date)));
await tester.pumpAndSettle();
await tester.tap(find.text('Hide column'));
await tester.pumpAndSettle();
projectRows.bringRemoteChanges();
await tester.pumpAndSettle();
expect(
find.byKey(ProjectTable.columnKey(TaskColumn.date)),
findsNothing,
);
await tester.tap(find.byKey(ProjectTable.columnKey(TaskColumn.task)));
await tester.pumpAndSettle();
await tester.tap(find.text('Sort descending'));
await tester.pumpAndSettle();
final projects = await tester.runAsync(
() => ProjectRepository(projectRows, keys).all(),
);
expect(kept(projects!)?.sorting, TaskSorting.name);
expect(kept(projects)?.descending, isTrue);
expect(kept(projects)?.columns, isNot(contains(TaskColumn.date)));
});
testWidgets('more columns than fit scroll sideways, nothing '
'overflowing', (tester) async {
await inboxOf(tester);
await asTable(
tester,
const ProjectView(
layout: ProjectLayout.table,
columns: TaskColumn.values,
),
);
tester.view.physicalSize = const Size(900, 700);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
expect(find.byKey(ProjectTable.headingKey), findsOneWidget);
expect(
find.byKey(ProjectTable.columnKey(TaskColumn.created)),
findsOneWidget,
);
});
testWidgets('a phone is not offered it, and shows a table kept '
'elsewhere as a list', (tester) async {
await inboxOf(tester);