icon things

This commit is contained in:
Leon Astner 2025-08-02 07:51:04 +02:00
parent a91654df03
commit 8bc45ad6fd
50 changed files with 592 additions and 213 deletions

View file

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../services/network_group_service.dart';
import '../widgets/network_demo_widget.dart';
class GroupPage extends StatefulWidget {
const GroupPage({super.key});
@ -172,9 +171,6 @@ class _GroupPageState extends State<GroupPage> {
const SizedBox(height: 25),
// Demo Widget
NetworkDemoWidget(networkService: networkService),
// Network Users Section
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -330,13 +326,34 @@ class _GroupPageState extends State<GroupPage> {
const SizedBox(height: 4),
Row(
children: [
Text(
'Joined ${_formatDuration(DateTime.now().difference(user.joinedAt))} ago',
style: const TextStyle(
color: Colors.grey,
fontSize: 12,
if (user.isListening && user.currentTrackName != null) ...[
const Icon(
Icons.music_note,
color: Color(0xFF6366F1),
size: 14,
),
),
const SizedBox(width: 4),
Expanded(
child: Text(
'Listening to "${user.currentTrackName}" by ${user.currentArtist}',
style: const TextStyle(
color: Color(0xFF6366F1),
fontSize: 12,
fontWeight: FontWeight.w500,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
] else ...[
Text(
'Joined ${_formatDuration(DateTime.now().difference(user.joinedAt))} ago',
style: const TextStyle(
color: Colors.grey,
fontSize: 12,
),
),
],
if (!user.isOnline) ...[
const Text(
'',
@ -366,20 +383,54 @@ class _GroupPageState extends State<GroupPage> {
],
),
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: const Color(0xFF6366F1).withOpacity(0.2),
borderRadius: BorderRadius.circular(10),
),
child: Text(
'${user.votes} votes',
style: const TextStyle(
color: Color(0xFF6366F1),
fontSize: 11,
fontWeight: FontWeight.bold,
Column(
children: [
if (user.isListening && !isCurrentUser) ...[
// Join Listening Session Button
IconButton(
onPressed: () async {
final success = await networkService.joinListeningSession(user);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
success
? 'Joined ${user.name}\'s listening session! 🎵'
: 'Failed to join listening session',
),
backgroundColor: success
? const Color(0xFF22C55E)
: const Color(0xFFEF4444),
duration: const Duration(seconds: 3),
),
);
}
},
icon: const Icon(
Icons.headphones,
color: Color(0xFF6366F1),
size: 20,
),
tooltip: 'Join listening session',
),
const SizedBox(height: 4),
],
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: const Color(0xFF6366F1).withOpacity(0.2),
borderRadius: BorderRadius.circular(10),
),
child: Text(
'${user.votes} votes',
style: const TextStyle(
color: Color(0xFF6366F1),
fontSize: 11,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
],
),