diff --git a/flutter/lib/library/view.dart b/flutter/lib/library/view.dart index c3da6d18..10e3c34c 100644 --- a/flutter/lib/library/view.dart +++ b/flutter/lib/library/view.dart @@ -562,35 +562,6 @@ class _ProductShellState extends State with RestorationMixin { controller.dispatch(LibraryQueryChanged(query)), ), ), - Padding( - padding: const EdgeInsets.fromLTRB(16, 4, 16, 8), - child: Align( - alignment: AlignmentDirectional.centerStart, - child: Wrap( - spacing: 8, - runSpacing: 4, - children: [ - for (final filter in [ - null, - FlutterBookFormat.pdf, - FlutterBookFormat.epub, - FlutterBookFormat.cbz, - ]) - ShadButton.raw( - variant: model.format == filter - ? ShadButtonVariant.primary - : ShadButtonVariant.outline, - size: ShadButtonSize.sm, - onPressed: () => - controller.dispatch(LibraryFormatChanged(filter)), - child: Text( - filter == null ? 'All' : filter.name.toUpperCase(), - ), - ), - ], - ), - ), - ), if (model.busy) Row( children: [ @@ -630,15 +601,38 @@ class _ProductShellState extends State with RestorationMixin { controller.dispatch(const LibraryRetryRequested()), ), Expanded( - child: LibraryCollection( - model: model, - openBook: (book) => - controller.dispatch(LibraryBookOpened(book)), - removeBook: (book) => - controller.dispatch(LibraryBookRemovalRequested(book)), - loadMore: () => - controller.dispatch(const LibraryMoreRequested()), - loadCover: controller.requestCover, + child: ShadTabs( + value: model.format?.name ?? 'all', + maintainState: false, + scrollable: true, + onChanged: (filter) => controller.dispatch( + LibraryFormatChanged( + filter == 'all' + ? null + : FlutterBookFormat.values.byName(filter), + ), + ), + tabs: [ + for (final filter in const ['all', 'pdf', 'epub', 'cbz']) + ShadTab( + value: filter, + expandContent: true, + content: LibraryCollection( + model: model, + openBook: (book) => + controller.dispatch(LibraryBookOpened(book)), + removeBook: (book) => controller.dispatch( + LibraryBookRemovalRequested(book), + ), + loadMore: () => + controller.dispatch(const LibraryMoreRequested()), + loadCover: controller.requestCover, + ), + child: Text( + filter == 'all' ? 'All' : filter.toUpperCase(), + ), + ), + ], ), ), ], diff --git a/flutter/test/goldens/library-cleanup-pending.png b/flutter/test/goldens/library-cleanup-pending.png index 84184dfe..81541c3b 100644 Binary files a/flutter/test/goldens/library-cleanup-pending.png and b/flutter/test/goldens/library-cleanup-pending.png differ diff --git a/flutter/test/goldens/library-compact-large-text.png b/flutter/test/goldens/library-compact-large-text.png index 67d339be..2e4226fa 100644 Binary files a/flutter/test/goldens/library-compact-large-text.png and b/flutter/test/goldens/library-compact-large-text.png differ diff --git a/flutter/test/goldens/library-expanded.png b/flutter/test/goldens/library-expanded.png index aee73829..37b3c344 100644 Binary files a/flutter/test/goldens/library-expanded.png and b/flutter/test/goldens/library-expanded.png differ diff --git a/flutter/test/goldens/library-managed-deletion-pending.png b/flutter/test/goldens/library-managed-deletion-pending.png index 74946279..3db42d62 100644 Binary files a/flutter/test/goldens/library-managed-deletion-pending.png and b/flutter/test/goldens/library-managed-deletion-pending.png differ