Files
SpotiFLAC-Mobile/lib/widgets/destructive_selection_button.dart
T
zarzet 44de61a06a refactor(screens): share album-screen scaffolding and track flows
- 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
2026-07-12 19:19:22 +07:00

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),
),
),
),
);
}
}