import 'package:flutter/material.dart'; class GroupPage extends StatefulWidget { const GroupPage({super.key}); @override State createState() => _GroupPageState(); } class _GroupPageState extends State { bool isConnectedToLido = true; // Simulate location verification String userName = "Guest #${DateTime.now().millisecond}"; List> activeUsers = [ {"name": "Alex M.", "joined": "2 min ago", "votes": 5, "isOnline": true}, {"name": "Sarah K.", "joined": "5 min ago", "votes": 3, "isOnline": true}, {"name": "Marco R.", "joined": "8 min ago", "votes": 7, "isOnline": true}, {"name": "Lisa F.", "joined": "12 min ago", "votes": 2, "isOnline": false}, {"name": "Tom B.", "joined": "15 min ago", "votes": 4, "isOnline": true}, ]; @override Widget build(BuildContext context) { return Container( color: const Color(0xFF121212), child: Padding( padding: const EdgeInsets.all(20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Location Status Card Container( width: double.infinity, padding: const EdgeInsets.all(20), decoration: BoxDecoration( color: isConnectedToLido ? const Color(0xFF22C55E).withOpacity(0.1) : const Color(0xFFEF4444).withOpacity(0.1), borderRadius: BorderRadius.circular(15), border: Border.all( color: isConnectedToLido ? const Color(0xFF22C55E) : const Color(0xFFEF4444), width: 1, ), ), child: Column( children: [ Icon( isConnectedToLido ? Icons.location_on : Icons.location_off, size: 40, color: isConnectedToLido ? const Color(0xFF22C55E) : const Color(0xFFEF4444), ), const SizedBox(height: 10), Text( isConnectedToLido ? '📍 Connected to Lido Schenna' : '❌ Not at Lido Schenna', style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: isConnectedToLido ? const Color(0xFF22C55E) : const Color(0xFFEF4444), ), ), const SizedBox(height: 5), Text( isConnectedToLido ? 'You can now vote and suggest music!' : 'Please visit Lido Schenna to participate', style: const TextStyle( color: Colors.grey, fontSize: 14, ), textAlign: TextAlign.center, ), ], ), ), const SizedBox(height: 25), // User Info Section Container( width: double.infinity, padding: const EdgeInsets.all(18), decoration: BoxDecoration( color: const Color(0xFF1E1E1E), borderRadius: BorderRadius.circular(12), ), child: Row( children: [ CircleAvatar( radius: 25, backgroundColor: const Color(0xFF6366F1), child: Text( userName.substring(0, 1), style: const TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold, ), ), ), const SizedBox(width: 15), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( userName, style: const TextStyle( color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600, ), ), const SizedBox(height: 4), const Text( 'Active since 5 minutes ago', style: TextStyle( color: Colors.grey, fontSize: 12, ), ), ], ), ), Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), decoration: BoxDecoration( color: const Color(0xFF6366F1).withOpacity(0.2), borderRadius: BorderRadius.circular(12), ), child: const Row( mainAxisSize: MainAxisSize.min, children: [ Icon( Icons.how_to_vote, color: Color(0xFF6366F1), size: 14, ), SizedBox(width: 4), Text( '3 votes', style: TextStyle( color: Color(0xFF6366F1), fontSize: 12, fontWeight: FontWeight.bold, ), ), ], ), ), ], ), ), const SizedBox(height: 25), // Active Users Section Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const Text( 'Active Guests', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, color: Colors.white, ), ), Container( padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), decoration: BoxDecoration( color: const Color(0xFF6366F1).withOpacity(0.2), borderRadius: BorderRadius.circular(12), ), child: Text( '${activeUsers.where((user) => user["isOnline"]).length} online', style: const TextStyle( color: Color(0xFF6366F1), fontSize: 12, fontWeight: FontWeight.bold, ), ), ), ], ), const SizedBox(height: 15), // Users List Expanded( child: ListView.builder( itemCount: activeUsers.length, itemBuilder: (context, index) { final user = activeUsers[index]; return Container( margin: const EdgeInsets.only(bottom: 10), padding: const EdgeInsets.all(15), decoration: BoxDecoration( color: const Color(0xFF1E1E1E), borderRadius: BorderRadius.circular(12), ), child: Row( children: [ Stack( children: [ CircleAvatar( radius: 20, backgroundColor: const Color(0xFF6366F1), child: Text( user["name"].toString().substring(0, 1), style: const TextStyle( color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold, ), ), ), if (user["isOnline"]) Positioned( right: 0, bottom: 0, child: Container( width: 12, height: 12, decoration: BoxDecoration( color: const Color(0xFF22C55E), shape: BoxShape.circle, border: Border.all(color: const Color(0xFF121212), width: 2), ), ), ), ], ), const SizedBox(width: 15), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( user["name"], style: const TextStyle( color: Colors.white, fontWeight: FontWeight.w500, fontSize: 16, ), ), const SizedBox(height: 4), Text( 'Joined ${user["joined"]}', style: const TextStyle( color: Colors.grey, fontSize: 12, ), ), ], ), ), 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, ), ), ), ], ), ); }, ), ), // Bottom Action Buttons Row( children: [ Expanded( child: ElevatedButton.icon( onPressed: isConnectedToLido ? () { // Refresh location/connection ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text('Location verified! ✓'), backgroundColor: Color(0xFF22C55E), duration: Duration(seconds: 2), ), ); } : null, icon: const Icon(Icons.refresh), label: const Text('Refresh Location'), style: ElevatedButton.styleFrom( backgroundColor: const Color(0xFF6366F1), foregroundColor: Colors.white, padding: const EdgeInsets.symmetric(vertical: 12), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), ), ), ), ], ), ], ), ), ); } }