mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-29 07:18:49 +02:00
- SelectionModeMixin + CollapsingHeaderScrollMixin extracted; local/downloaded album screens now share AlbumTrackTile, AlbumScaffoldBody, DestructiveSelectionButton, HeaderMetaRow, and confirmAndDeleteTracks - track_detail_actions.dart: shared downloadSingleTrack, queueTracksSkippingDownloaded, download-all confirm, queued snackbar, release-date formatter, list footer, love-all - TtlCache<T> replaces the copied 10-minute static caches; album fetch branches share _applyAlbumMetadata - playlist error card now uses ErrorCard; formatMegabytes shared by queue tab and update dialog
47 lines
1.4 KiB
Dart
47 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:spotiflac_android/l10n/l10n.dart';
|
|
|
|
/// Full-width delete action for selection-mode bottom bars: destructive
|
|
/// (error) styling once at least one item is selected, disabled/neutral
|
|
/// otherwise.
|
|
class DestructiveSelectionButton extends StatelessWidget {
|
|
const DestructiveSelectionButton({
|
|
super.key,
|
|
required this.count,
|
|
required this.colorScheme,
|
|
required this.onPressed,
|
|
});
|
|
|
|
final int count;
|
|
final ColorScheme colorScheme;
|
|
final VoidCallback onPressed;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: double.infinity,
|
|
child: FilledButton.icon(
|
|
onPressed: count > 0 ? onPressed : null,
|
|
icon: const Icon(Icons.delete_outline),
|
|
label: Text(
|
|
count > 0
|
|
? context.l10n.downloadedAlbumDeleteCount(count)
|
|
: context.l10n.downloadedAlbumSelectToDelete,
|
|
),
|
|
style: FilledButton.styleFrom(
|
|
backgroundColor: count > 0
|
|
? colorScheme.error
|
|
: colorScheme.surfaceContainerHighest,
|
|
foregroundColor: count > 0
|
|
? colorScheme.onError
|
|
: colorScheme.onSurfaceVariant,
|
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|