mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-22 07:18:38 +02:00
The Material theme now draws its main surfaces with rounded Material Symbols: navigation, player, mini player, queue, settings, sheets, dialogs and shared controls. AppIcon maps legacy Icons to their symbol and keeps outlined glyphs unfilled. Mornye keeps its original icons. Icon buttons, text and filled buttons, dialog actions, sliders, the setup FAB and indeterminate spinners use the Material 3 Expressive components. Each wrapper falls back to the standard Flutter widget for Mornye, reduced motion and custom sizing, so existing layouts and hit areas stay intact.
86 lines
2.8 KiB
Dart
86 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:spotiflac_android/theme/mornye_theme.dart';
|
|
import 'package:spotiflac_android/l10n/l10n.dart';
|
|
import 'package:spotiflac_android/theme/app_tokens.dart';
|
|
import 'package:spotiflac_android/widgets/app_icon_button.dart';
|
|
import 'package:spotiflac_android/widgets/track_card.dart';
|
|
|
|
/// Album-style track row: track number, title/subtitle, and a trailing play
|
|
/// button that's hidden once selection mode is active.
|
|
///
|
|
/// A thin arrangement over [TrackCard]; the container, selection tick, padding
|
|
/// and typography all come from there.
|
|
class AlbumTrackTile extends StatelessWidget {
|
|
const AlbumTrackTile({
|
|
super.key,
|
|
required this.trackNumber,
|
|
required this.trackName,
|
|
required this.subtitle,
|
|
required this.isSelectionMode,
|
|
required this.isSelected,
|
|
required this.colorScheme,
|
|
required this.onToggleSelection,
|
|
required this.onOpen,
|
|
required this.onEnterSelectionMode,
|
|
required this.onPlay,
|
|
this.isPlaying = false,
|
|
});
|
|
|
|
final int? trackNumber;
|
|
final String trackName;
|
|
final Widget subtitle;
|
|
final bool isSelectionMode;
|
|
final bool isSelected;
|
|
final ColorScheme colorScheme;
|
|
final VoidCallback onToggleSelection;
|
|
final VoidCallback onOpen;
|
|
final VoidCallback onEnterSelectionMode;
|
|
final VoidCallback onPlay;
|
|
final bool isPlaying;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TrackCard(
|
|
style: TrackCardStyle.flat,
|
|
isSelectionMode: isSelectionMode,
|
|
isSelected: isSelected,
|
|
onTap: isSelectionMode ? onToggleSelection : onOpen,
|
|
onLongPress: isSelectionMode ? null : onEnterSelectionMode,
|
|
leading: SizedBox(
|
|
width: 24,
|
|
child: Text(
|
|
trackNumber?.toString() ?? '-',
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
color: colorScheme.onSurfaceVariant,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
),
|
|
title: trackName,
|
|
subtitle: subtitle,
|
|
trailing: AppIconButton(
|
|
tooltip: isPlaying
|
|
? context.l10n.actionPause
|
|
: context.l10n.tooltipPlay,
|
|
onPressed: onPlay,
|
|
icon: Icon(
|
|
context.isMornye
|
|
? (isPlaying
|
|
? CupertinoIcons.pause_fill
|
|
: CupertinoIcons.play_fill)
|
|
: (isPlaying ? Icons.pause : Icons.play_arrow),
|
|
color: colorScheme.primary,
|
|
),
|
|
style: IconButton.styleFrom(
|
|
minimumSize: Size.square(context.tokens.minTouchTarget),
|
|
backgroundColor: context.isMornye
|
|
? Colors.transparent
|
|
: colorScheme.primaryContainer.withValues(alpha: 0.3),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|