Make the shell top bar hide/reveal with scroll, per tab

Each regular tab (Files/Photos/Favorites/Shares/Recent/Activity/Trash)
now plants its own AppTopBar as the first sliver in its own
CustomScrollView, via a new topBarSliver() helper (tab_state_slivers.dart)
wrapping the framework's SliverFloatingHeader, instead of one shared
instance living in Scaffold.appBar.

This gives each tab's top bar Material's native floating-app-bar
behavior - tied to that tab's own ScrollController - scrolling away as
the list scrolls down and reappearing the moment the drag reverses,
not only once scrolled all the way back to the top, which a single
fixed Scaffold.appBar (or the "put it in a SliverToBoxAdapter" escape
hatch NooTopBar's doc comment already mentioned) can't do. It sits
above each tab's own pinned in-content sticky header (the sort/filter
row, or the selection bar that replaces it), which keeps working
unchanged underneath it.

main.dart builds a separate, correctly-labelled AppTopBar per tab
(rather than one for "whichever tab is selected") and passes it through
buildAppTabView's new optional topBar parameter; it's null on desktop
(which keeps its own NooToolbar) and while picking, matching the old
Scaffold.appBar: pickRequest == null guard.

SliverFloatingHeader sizes itself from the bar's own natural layout
(like SliverToBoxAdapter) rather than a fixed extent declared up front,
so NooTopBar's own internal SafeArea keeps handling the status-bar inset
correctly with no extra height math needed on this side.

Adds a widget test (test/widgets/tabs/tab_state_slivers_test.dart)
driving a raw gesture mid-drag to verify the reveal-follows-finger
behavior, since a single tester.drag() only pumps after the gesture -
including release - has already finished, which doesn't exercise the
live per-frame reveal this change depends on.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 16:28:36 -04:00
co-authored by Claude Sonnet 5
parent 5f4caa2a3b
commit 5dea9038f7
13 changed files with 296 additions and 29 deletions
+6 -1
View File
@@ -29,7 +29,11 @@ import '../widgets/tabs/tab_state_slivers.dart';
class ActivityView extends StatelessWidget {
final ScrollController scrollController;
const ActivityView({super.key, required this.scrollController});
/// This tab's own shell top bar, planted as its first sliver - see
/// `buildAppTabView`'s doc comment. Null on desktop and while picking.
final PreferredSizeWidget? topBar;
const ActivityView({super.key, required this.scrollController, this.topBar});
@override
Widget build(BuildContext context) {
@@ -90,6 +94,7 @@ class ActivityView extends StatelessWidget {
}
final List<Widget> contentSlivers = [
if (topBar != null) topBarSliver(topBar!),
const SliverToBoxAdapter(child: SizedBox(height: NooSpace.md)),
feed,
...tabBottomInsetSlivers,
+7 -1
View File
@@ -30,6 +30,7 @@ import '../widgets/noo/core/noo_button.dart';
import '../widgets/share_sheet.dart';
import '../widgets/sticky_header_delegate.dart';
import '../widgets/synced_header_scaffold.dart' show formatBytes;
import '../widgets/tabs/tab_state_slivers.dart';
import 'file_viewer_screen.dart';
import 'move_copy_destination_picker.dart';
@@ -50,7 +51,11 @@ import 'move_copy_destination_picker.dart';
class FavoritesView extends StatefulWidget {
final ScrollController scrollController;
const FavoritesView({super.key, required this.scrollController});
/// This tab's own shell top bar, planted as its first sliver - see
/// `buildAppTabView`'s doc comment. Null on desktop and while picking.
final PreferredSizeWidget? topBar;
const FavoritesView({super.key, required this.scrollController, this.topBar});
@override
State<FavoritesView> createState() => _FavoritesViewState();
@@ -507,6 +512,7 @@ class _FavoritesViewState extends State<FavoritesView> {
);
final contentSlivers = <Widget>[
if (widget.topBar != null) topBarSliver(widget.topBar!),
SliverPersistentHeader(
pinned: !_isSelecting,
delegate: StickyHeaderDelegate(
+7
View File
@@ -43,6 +43,7 @@ import '../widgets/noo/noo_layout.dart';
import '../widgets/noo/overlays/noo_sheet.dart';
import '../widgets/share_sheet.dart';
import '../widgets/sticky_header_delegate.dart';
import '../widgets/tabs/tab_state_slivers.dart';
import '../widgets/synced_header_scaffold.dart' show formatBytes;
import 'file_viewer_screen.dart';
import 'move_copy_destination_picker.dart';
@@ -59,10 +60,15 @@ class FilesView extends StatefulWidget {
final ScrollController scrollController;
final bool offline;
/// This tab's own shell top bar, planted as its first sliver - see
/// `buildAppTabView`'s doc comment. Null on desktop and while picking.
final PreferredSizeWidget? topBar;
const FilesView({
super.key,
required this.scrollController,
this.offline = false,
this.topBar,
});
@override
@@ -653,6 +659,7 @@ class _FilesViewState extends State<FilesView> {
);
final List<Widget> contentSlivers = [
if (widget.topBar != null) topBarSliver(widget.topBar!),
// Pinned in both states - while browsing this is the controls row
// (+ breadcrumbs), while selecting it's the selection bar (see
// `topRow` above): either way it's the one thing that always stays
+7 -1
View File
@@ -30,6 +30,7 @@ import '../widgets/noo/overlays/noo_sheet.dart';
import '../widgets/share_sheet.dart';
import '../widgets/sort_menu_button.dart' show sortFieldLabel;
import '../widgets/sticky_header_delegate.dart';
import '../widgets/tabs/tab_state_slivers.dart';
import 'file_viewer_screen.dart';
import 'move_copy_destination_picker.dart';
@@ -53,7 +54,11 @@ class _MonthGroup {
class PhotosView extends StatefulWidget {
final ScrollController scrollController;
const PhotosView({super.key, required this.scrollController});
/// This tab's own shell top bar, planted as its first sliver - see
/// `buildAppTabView`'s doc comment. Null on desktop and while picking.
final PreferredSizeWidget? topBar;
const PhotosView({super.key, required this.scrollController, this.topBar});
@override
State<PhotosView> createState() => _PhotosViewState();
@@ -239,6 +244,7 @@ class _PhotosViewState extends State<PhotosView> {
);
final List<Widget> contentSlivers = [
if (widget.topBar != null) topBarSliver(widget.topBar!),
// Sticky while browsing; once selecting, the selection bar takes over
// the same slot instead.
SliverPersistentHeader(
+6 -1
View File
@@ -27,7 +27,11 @@ import 'file_viewer_screen.dart';
class RecentView extends StatefulWidget {
final ScrollController scrollController;
const RecentView({super.key, required this.scrollController});
/// This tab's own shell top bar, planted as its first sliver - see
/// `buildAppTabView`'s doc comment. Null on desktop and while picking.
final PreferredSizeWidget? topBar;
const RecentView({super.key, required this.scrollController, this.topBar});
@override
State<RecentView> createState() => _RecentViewState();
@@ -54,6 +58,7 @@ class _RecentViewState extends State<RecentView> {
);
final List<Widget> contentSlivers = [
if (widget.topBar != null) topBarSliver(widget.topBar!),
const SliverToBoxAdapter(child: SizedBox(height: NooSpace.md)),
if (recent.isLoading && items.isEmpty)
tabLoadingSliver
+6 -1
View File
@@ -53,7 +53,11 @@ String _permissionLabel(int permissions) {
class SharesView extends StatefulWidget {
final ScrollController scrollController;
const SharesView({super.key, required this.scrollController});
/// This tab's own shell top bar, planted as its first sliver - see
/// `buildAppTabView`'s doc comment. Null on desktop and while picking.
final PreferredSizeWidget? topBar;
const SharesView({super.key, required this.scrollController, this.topBar});
@override
State<SharesView> createState() => _SharesViewState();
@@ -81,6 +85,7 @@ class _SharesViewState extends State<SharesView> {
final isDesktop = NooLayout.isDesktop(context);
final List<Widget> contentSlivers = [
if (widget.topBar != null) topBarSliver(widget.topBar!),
SliverPadding(
padding: EdgeInsets.fromLTRB(
NooLayout.gutter(context),
+6 -1
View File
@@ -25,7 +25,11 @@ import '../widgets/tabs/tab_state_slivers.dart';
class TrashView extends StatefulWidget {
final ScrollController scrollController;
const TrashView({super.key, required this.scrollController});
/// This tab's own shell top bar, planted as its first sliver - see
/// `buildAppTabView`'s doc comment. Null on desktop and while picking.
final PreferredSizeWidget? topBar;
const TrashView({super.key, required this.scrollController, this.topBar});
@override
State<TrashView> createState() => _TrashViewState();
@@ -50,6 +54,7 @@ class _TrashViewState extends State<TrashView> {
final isDesktop = NooLayout.isDesktop(context);
final List<Widget> contentSlivers = [
if (widget.topBar != null) topBarSliver(widget.topBar!),
SliverPadding(
padding: EdgeInsets.fromLTRB(
NooLayout.gutter(context),