refactor(screens): migrate remaining screens to shared header and selection components

- album/playlist/library-folder/track-metadata adopt
  CollapsingHeaderScrollMixin; artist/library-folder adopt
  SelectionModeMixin
- HeaderCircleButton and HeaderMetaRow replace per-screen copies
  in album and playlist headers; dead _tallHeader flag removed
- SelectionBottomBar gains optional subtitle labels and backs the
  playlist selection bar in queue tab
This commit is contained in:
zarzet
2026-07-12 19:38:50 +07:00
parent 44de61a06a
commit 62015a4e2d
8 changed files with 259 additions and 559 deletions
+39
View File
@@ -283,6 +283,45 @@ class AlbumPlayActions extends StatelessWidget {
}
}
/// 48x48 translucent-white circle icon button used in album/playlist headers
/// (add-to-playlist, love-all, ...).
class HeaderCircleButton extends StatelessWidget {
const HeaderCircleButton({
super.key,
required this.icon,
required this.tooltip,
required this.onPressed,
this.iconColor = Colors.white,
});
final IconData icon;
final String tooltip;
final VoidCallback? onPressed;
final Color iconColor;
@override
Widget build(BuildContext context) {
return Container(
width: 48,
height: 48,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white.withValues(alpha: 0.15),
border: Border.all(
color: Colors.white.withValues(alpha: 0.3),
width: 1,
),
),
child: IconButton(
onPressed: onPressed,
icon: Icon(icon, size: 22, color: iconColor),
tooltip: tooltip,
padding: EdgeInsets.zero,
),
);
}
}
/// "•"-joined row of white [HeaderMetaItem]s shown under the header subtitle
/// (track count, duration, quality, ...).
class HeaderMetaRow extends StatelessWidget {
+12 -2
View File
@@ -13,6 +13,8 @@ class SelectionBottomBar extends StatelessWidget {
required this.onToggleSelectAll,
required this.bottomPadding,
required this.children,
this.allSelectedLabel,
this.tapToSelectLabel,
});
final int selectedCount;
@@ -22,6 +24,12 @@ class SelectionBottomBar extends StatelessWidget {
final double bottomPadding;
final List<Widget> children;
/// Overrides the default "All tracks selected" subtitle.
final String? allSelectedLabel;
/// Overrides the default "Tap tracks to select" subtitle.
final String? tapToSelectLabel;
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
@@ -80,8 +88,10 @@ class SelectionBottomBar extends StatelessWidget {
),
Text(
allSelected
? context.l10n.selectionAllSelected
: context.l10n.downloadedAlbumTapToSelect,
? allSelectedLabel ??
context.l10n.selectionAllSelected
: tapToSelectLabel ??
context.l10n.downloadedAlbumTapToSelect,
style: Theme.of(context).textTheme.bodySmall
?.copyWith(color: colorScheme.onSurfaceVariant),
),