Runs: multi-select delete, run sizes and Largest-first sort

- Select mode (bar Select or long-press): per-row checkboxes, per-day
  Select all/Deselect all over finished runs only, "N selected" with the
  selection size, Delete and Done. Active runs get a disabled checkbox
  whose semantics give the reason.
- Native destructive confirmation, then delete_runs {run_ids} (batched by
  1000); the nested runs_deleted reply removes deleted rows and reports
  "Deleted N runs, freed X" plus refusals verbatim. runs_removed pushes
  remove rows and close an open detail; a deleted open run closes too.
  Delete run in the row and detail menus.
- size_bytes shown compactly in rows (0/absent = unknown, nothing shown),
  updated from run_event frames that carry it; Largest first sort (flat,
  unknowns last); the sort choice persists.
- Shared AppListRow gains selectionControl and onLongPress.
- Browser probe tool/runs_delete_probe.mjs; fixture server implements
  delete_runs/runs_removed.
This commit is contained in:
2026-10-31 22:19:36 +00:00
parent 62b56e66d0
commit 266916f92a
22 changed files with 1928 additions and 142 deletions
+31 -4
View File
@@ -23,7 +23,9 @@ const appListRowDividerKey = ValueKey<String>('app-list-row-divider');
/// Layout: [leading] (an [AppListAvatar]), then a bold one-line [title] with
/// the [time] at its trailing edge, then one muted [subtitle] line (with an
/// optional [subtitleLeading] dot/prefix and [subtitleTrailing] mark), then
/// the optional [menu] (an `AppOverflowMenu`). An inset hairline [divider]
/// the optional [menu] (an `AppOverflowMenu`). A row in a multi-select list
/// puts its checkbox in [selectionControl], which leads the row even when it
/// is compact. An inset hairline [divider]
/// under the text column separates rows. Nothing has a fixed height: the row
/// grows with text scaling and every line ellipsises.
///
@@ -43,6 +45,8 @@ class AppListRow extends StatelessWidget {
this.subtitleTrailing,
this.menu,
this.onTap,
this.onLongPress,
this.selectionControl,
this.tapKey,
this.selected = false,
this.emphasized = false,
@@ -64,6 +68,12 @@ class AppListRow extends StatelessWidget {
final Widget? menu;
final VoidCallback? onTap;
/// A touch long-press on the row (for example, entering a select mode).
final VoidCallback? onLongPress;
/// A checkbox leading the row in a multi-select list; kept when compact.
final Widget? selectionControl;
/// Placed on the tap target ([InkWell] / [GestureDetector]).
final Key? tapKey;
final bool selected;
@@ -112,6 +122,11 @@ class AppListRow extends StatelessWidget {
),
child: Row(
children: [
if (selectionControl case final control?)
Padding(
padding: const EdgeInsetsDirectional.only(end: 8),
child: control,
),
if (showLeading)
Padding(
padding: const EdgeInsetsDirectional.only(end: _avatarGap),
@@ -130,6 +145,7 @@ class AppListRow extends StatelessWidget {
? _CupertinoRowSurface(
tapKey: tapKey,
onTap: onTap,
onLongPress: onLongPress,
selected: selected,
child: content,
)
@@ -138,11 +154,19 @@ class AppListRow extends StatelessWidget {
color: selected
? selectedColor(context, cupertino: false)
: Colors.transparent,
child: InkWell(key: tapKey, onTap: onTap, child: content),
child: InkWell(
key: tapKey,
onTap: onTap,
onLongPress: onLongPress,
child: content,
),
);
if (!divider) return surface;
final textStart =
start + (showLeading ? kAppListAvatarSize + _avatarGap : 0);
// The divider stays under the text column; a checkbox's width is
// not known here, so a selectable row's divider starts at the inset.
final textStart = selectionControl != null
? start
: start + (showLeading ? kAppListAvatarSize + _avatarGap : 0);
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -289,11 +313,13 @@ class _CupertinoRowSurface extends StatefulWidget {
required this.tapKey,
required this.onTap,
required this.selected,
this.onLongPress,
required this.child,
});
final Key? tapKey;
final VoidCallback? onTap;
final VoidCallback? onLongPress;
final bool selected;
final Widget child;
@@ -320,6 +346,7 @@ class _CupertinoRowSurfaceState extends State<_CupertinoRowSurface> {
key: widget.tapKey,
behavior: HitTestBehavior.opaque,
onTap: widget.onTap,
onLongPress: widget.onLongPress,
onTapDown: enabled ? (_) => _press(true) : null,
onTapUp: enabled ? (_) => _press(false) : null,
onTapCancel: enabled ? () => _press(false) : null,