Skip to content

Commit

Permalink
Merge pull request #1 from mg143pavankumar/dev
Browse files Browse the repository at this point in the history
Finished project
  • Loading branch information
mistrypavankumar committed May 27, 2021
2 parents 0ccfdf3 + df9337c commit 944107d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 22 deletions.
20 changes: 3 additions & 17 deletions assets/radio.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,6 @@
},
{
"id": 6,
"name": "94",
"tagline": "Today's Hits",
"color": "0xff27383e",
"desc": "",
"url": "http://playerservices.streamtheworld.com/api/livestream-redirect/977_HITS.mp3",
"icon": "https://static.radio.net/images/broadcasts/8d/76/3600/1/c175.png",
"image": "https://i.ytimg.com/vi/BUnPVjqb0YY/maxresdefault.jpg",
"lang": "English",
"category": "rock",
"disliked": false,
"order": 6
},
{
"id": 7,
"name": "93",
"tagline": "Love Songs",
"color": "0xffa06a37",
Expand All @@ -96,10 +82,10 @@
"lang": "Hindi",
"category": "pop",
"disliked": false,
"order": 7
"order": 6
},
{
"id": 8,
"id": 7,
"name": "107",
"tagline": "Rocking Retro Hits",
"color": "0xff090909",
Expand All @@ -110,7 +96,7 @@
"lang": "Hindi",
"category": "classic",
"disliked": false,
"order": 8
"order": 7
}
]

Expand Down
43 changes: 39 additions & 4 deletions lib/pages/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class _HomeScreenState extends State<HomeScreen> {
fetchRadios() async {
final radioJson = await rootBundle.loadString("assets/radio.json");
radios = MyRadioList.fromJson(radioJson).radios;
setState(() {});
}

_playMusic(String url) {
Expand All @@ -50,7 +51,32 @@ class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: Drawer(),
drawer: Drawer(
child: Container(
color: _selectedColor ?? AIColors.primaryColor2,
child: radios != null
? [
100.heightBox,
"All Channel".text.xl.white.semiBold.make().px16(),
20.heightBox,
ListView(
padding: Vx.m0,
shrinkWrap: true,
children: radios
.map(
(e) => ListTile(
leading: CircleAvatar(
backgroundImage: NetworkImage(e.icon),
),
title: "${e.name} FM".text.white.make(),
subtitle: e.tagline.text.white.make(),
),
)
.toList()),
].vStack()
: const Offstage(),
),
),
body: Stack(
children: [
VxAnimatedBox()
Expand All @@ -59,12 +85,15 @@ class _HomeScreenState extends State<HomeScreen> {
LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [AIColors.primaryColor1, AIColors.primaryColor2],
colors: [
AIColors.primaryColor2,
_selectedColor ?? AIColors.primaryColor1,
],
),
)
.make(),
AppBar(
title: "AI Radio".text.xl4.bold.white.make().shimmer(
title: "MG Radio".text.xl4.bold.white.make().shimmer(
primaryColor: Vx.purple300,
secondaryColor: Colors.white,
),
Expand All @@ -75,6 +104,11 @@ class _HomeScreenState extends State<HomeScreen> {
radios != null
? VxSwiper.builder(
itemCount: radios.length,
onPageChanged: (index) {
final colorHex = radios[index].color;
_selectedColor = Color(int.tryParse(colorHex));
setState(() {});
},
aspectRatio: 1.0,
enlargeCenterPage: true,
itemBuilder: (context, index) {
Expand Down Expand Up @@ -137,7 +171,7 @@ class _HomeScreenState extends State<HomeScreen> {
).centered()
: CircularProgressIndicator(
backgroundColor: Colors.white,
),
).centered(),
Align(
alignment: Alignment.bottomCenter,
child: [
Expand All @@ -151,6 +185,7 @@ class _HomeScreenState extends State<HomeScreen> {
? CupertinoIcons.stop_circle
: CupertinoIcons.play_circle,
color: Colors.white,
size: 40,
).onInkTap(() {
if (_isPlaying) {
_audioPlayer.stop();
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ packages:
source: hosted
version: "2.1.0"
http:
dependency: transitive
dependency: "direct main"
description:
name: http
url: "https://pub.dartlang.org"
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencies:
audioplayers: ^0.19.0
cupertino_icons: ^1.0.3
google_fonts: ^2.1.0
http: ^0.13.3
velocity_x: ^3.1.1

dev_dependencies:
Expand Down

0 comments on commit 944107d

Please sign in to comment.