import 'package:flutter/material.dart';
import 'package:just_audio/just_audio.dart';
void main() {
runApp(LegacyMixesRadioApp());
}
class LegacyMixesRadioApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Legacy Mixes Radio',
debugShowCheckedModeBanner: false,
home: RadioHomePage(),
);
}
}
class RadioHomePage extends StatefulWidget {
@override
_RadioHomePageState createState() => _RadioHomePageState();
}
class _RadioHomePageState extends State {
final player = AudioPlayer();
bool isPlaying = false;
@override
void dispose() {
player.dispose();
super.dispose();
}
Future playStream() async {
await player.setUrl("https://surf.aloncast.com/s/legacymixes");
player.play();
setState(() => isPlaying = true);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0xFFFF5E62), // Ibiza sunset pink
Color(0xFFFF9966), // neon orange
Color(0xFF8E2DE2), // deep purple
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Legacy Mixes Radio",
style: TextStyle(
color: Colors.white,
fontSize: 32,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 40),
ElevatedButton(
onPressed: isPlaying ? null : playStream,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
foregroundColor: Colors.black,
padding: EdgeInsets.symmetric(horizontal: 40, vertical: 20),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
child: Text(
isPlaying ? "Playing…" : "Play",
style: TextStyle(fontSize: 20),
),
),
],
),
),
),
);
}
}