From d6448984d9ffe340a136d3b9664e76bb0402d26e Mon Sep 17 00:00:00 2001 From: Ayushya Amitabh Date: Mon, 5 Oct 2026 22:13:45 -0400 Subject: [PATCH] Files: don't context.watch from the item tap handler watch outside build asserts in debug builds, so taps on rows silently did nothing in debug (release strips the assert, which hid it on Android). Co-Authored-By: Claude Sonnet 5.5 --- lib/views/files_view.dart | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/views/files_view.dart b/lib/views/files_view.dart index f834097..32ab264 100644 --- a/lib/views/files_view.dart +++ b/lib/views/files_view.dart @@ -245,9 +245,19 @@ class _FilesViewState extends State { /// The folder data source for this tab. Watches the concrete controller /// (that's what's registered as a provider), then hands it back as the /// [FolderBrowser] the rest of the view actually needs. - FolderBrowser _browserOf(BuildContext context) => _offline - ? context.watch() - : context.watch(); + /// + /// Pass `listen: false` from tap/gesture callbacks: `context.watch` outside + /// of `build` asserts in debug builds (silently swallowing the tap). + FolderBrowser _browserOf(BuildContext context, {bool listen = true}) { + if (listen) { + return _offline + ? context.watch() + : context.watch(); + } + return _offline + ? context.read() + : context.read(); + } /// The on-device copy of [item] for the Offline tab; null online, where /// thumbnails come from server previews instead. @@ -287,7 +297,7 @@ class _FilesViewState extends State { NextcloudItem item, { required bool picking, }) { - final browser = _browserOf(context); + final browser = _browserOf(context, listen: false); if (picking) { _handlePickTap(context, item); } else if (_isSelecting) {