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) {