Initial commit: AudiOhm - Alternative Spotify avec streaming YouTube
Backend: - FastAPI avec PostgreSQL et Redis - Authentification JWT complète - API REST pour musique, playlists, recherche - Streaming audio via yt-dlp - SQLAlchemy 2.0 async Frontend: - Flutter avec thème néon cyberpunk - State management Riverpod - Layout adaptatif desktop/mobile - Lecteur audio avec mini-player Infrastructure: - Docker Compose (PostgreSQL + Redis) - Scripts d'installation automatisés - Scripts de build pour exécutables Fichiers ajoutés: - BUILD_CLIENT_*.bat/sh: Scripts de compilation - BUILD_CLIENT_README.md: Documentation compilation - CHECK_FLUTTER.sh: Vérificateur d'environnement - requirements.txt mis à jour pour Python 3.13 - Modèles SQLAlchemy corrigés (metadata -> extra_metadata) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,292 @@
|
||||
/// Playlist Track Tile - Displays a track in a playlist with drag-to-reorder support
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../domain/entities/track.dart';
|
||||
import '../../../../core/theme/colors.dart';
|
||||
import '../common/cached_network_image_with_fallback.dart';
|
||||
|
||||
/// Playlist track tile
|
||||
class PlaylistTrackTile extends StatelessWidget {
|
||||
final Track track;
|
||||
final int position;
|
||||
final bool isOwner;
|
||||
final bool isDragging;
|
||||
final VoidCallback? onTap;
|
||||
final VoidCallback? onRemove;
|
||||
final VoidCallback? onAddToQueue;
|
||||
final VoidCallback? onDragStart;
|
||||
|
||||
const PlaylistTrackTile({
|
||||
required this.track,
|
||||
required this.position,
|
||||
this.isOwner = false,
|
||||
this.isDragging = false,
|
||||
this.onTap,
|
||||
this.onRemove,
|
||||
this.onAddToQueue,
|
||||
this.onDragStart,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: isDragging
|
||||
? AppColors.surfaceElevated.withOpacity(0.5)
|
||||
: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: isDragging
|
||||
? AppColors.cyan.withOpacity(0.5)
|
||||
: Colors.transparent,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
// Drag handle (for owners)
|
||||
if (isOwner)
|
||||
_buildDragHandle()
|
||||
else
|
||||
_buildPositionNumber(),
|
||||
|
||||
const SizedBox(width: 12),
|
||||
|
||||
// Album art
|
||||
_buildAlbumArt(),
|
||||
|
||||
const SizedBox(width: 12),
|
||||
|
||||
// Track info
|
||||
Expanded(
|
||||
child: _buildTrackInfo(),
|
||||
),
|
||||
|
||||
// Duration
|
||||
_buildDuration(),
|
||||
|
||||
const SizedBox(width: 8),
|
||||
|
||||
// Menu button
|
||||
_buildMenuButton(context),
|
||||
|
||||
// Remove button (for owners)
|
||||
if (isOwner) ...[
|
||||
const SizedBox(width: 8),
|
||||
_buildRemoveButton(),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDragHandle() {
|
||||
return GestureDetector(
|
||||
onPanStart: (_) => onDragStart?.call(),
|
||||
child: Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
Icons.drag_handle,
|
||||
color: AppColors.onSurfaceVariant,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPositionNumber() {
|
||||
return SizedBox(
|
||||
width: 24,
|
||||
child: Text(
|
||||
'${position + 1}',
|
||||
style: TextStyle(
|
||||
color: AppColors.onSurfaceVariant,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAlbumArt() {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: SizedBox(
|
||||
width: 48,
|
||||
height: 48,
|
||||
child: CachedNetworkImageWithFallback(
|
||||
imageUrl: track.imageUrl,
|
||||
fallbackIcon: Icons.music_note,
|
||||
progressColor: AppColors.cyan,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTrackInfo() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
track.title,
|
||||
style: const TextStyle(
|
||||
color: AppColors.onBackground,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
track.artist?.name ?? 'Unknown Artist',
|
||||
style: const TextStyle(
|
||||
color: AppColors.onSurfaceVariant,
|
||||
fontSize: 13,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDuration() {
|
||||
return Text(
|
||||
track.formattedDuration,
|
||||
style: const TextStyle(
|
||||
color: AppColors.onSurfaceVariant,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMenuButton(BuildContext context) {
|
||||
return PopupMenuButton<String>(
|
||||
icon: Icon(
|
||||
Icons.more_vert,
|
||||
color: AppColors.onSurfaceVariant,
|
||||
),
|
||||
color: AppColors.surfaceElevated,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
color: AppColors.cyan.withOpacity(0.3),
|
||||
),
|
||||
),
|
||||
onSelected: (value) {
|
||||
switch (value) {
|
||||
case 'queue':
|
||||
onAddToQueue?.call();
|
||||
break;
|
||||
case 'remove':
|
||||
onRemove?.call();
|
||||
break;
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
value: 'queue',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.queue_music, color: AppColors.cyan, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
const Text(
|
||||
'Add to queue',
|
||||
style: TextStyle(color: AppColors.onBackground),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isOwner)
|
||||
PopupMenuItem(
|
||||
value: 'remove',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.remove_circle_outline, color: AppColors.rose, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
const Text(
|
||||
'Remove from playlist',
|
||||
style: TextStyle(color: AppColors.onBackground),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRemoveButton() {
|
||||
return IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove_circle_outline,
|
||||
color: AppColors.rose,
|
||||
size: 20,
|
||||
),
|
||||
onPressed: onRemove,
|
||||
tooltip: 'Remove from playlist',
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 32,
|
||||
minHeight: 32,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Reorderable playlist track tile
|
||||
class ReorderablePlaylistTrackTile extends StatelessWidget {
|
||||
final Track track;
|
||||
final int position;
|
||||
final bool isOwner;
|
||||
final VoidCallback? onTap;
|
||||
final VoidCallback? onRemove;
|
||||
final VoidCallback? onAddToQueue;
|
||||
|
||||
const ReorderablePlaylistTrackTile({
|
||||
required this.track,
|
||||
required this.position,
|
||||
this.isOwner = false,
|
||||
this.onTap,
|
||||
this.onRemove,
|
||||
this.onAddToQueue,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ReorderableDragStartListener(
|
||||
key: ValueKey(track.id),
|
||||
index: position,
|
||||
enabled: isOwner,
|
||||
child: PlaylistTrackTile(
|
||||
track: track,
|
||||
position: position,
|
||||
isOwner: isOwner,
|
||||
onTap: onTap,
|
||||
onRemove: onRemove,
|
||||
onAddToQueue: onAddToQueue,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user