Skip to content

Commit f89493e

Browse files
committed
added function to play music
1 parent f1e7d41 commit f89493e

File tree

7 files changed

+163
-33
lines changed

7 files changed

+163
-33
lines changed

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ android {
3333
minSdkVersion 16
3434
targetSdkVersion 30
3535
versionCode flutterVersionCode.toInteger()
36-
versionName "0.0.1"
36+
versionName "0.0.11"
3737
}
3838

3939
buildTypes {

lib/global/global_parameters.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ abstract class GlobalParameters {
101101
SnappingSheetController();
102102
static AnimationController playAnimationController;
103103
static AnimationController waveController;
104+
static AnimationController circleController;
104105
static final ValueNotifier<bool> playNotifier = ValueNotifier(false);
105106
static final ValueNotifier<Song> currentSong = ValueNotifier(songs[0]);
106107
static int songId = songs[0].id;

lib/screens/home_screen.dart

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:animated_text_kit/animated_text_kit.dart';
12
import 'package:codeine/global/global_parameters.dart';
23
import 'package:codeine/models/user.dart';
34
import 'package:codeine/widgets/music_player.dart';
@@ -63,11 +64,76 @@ class _Header extends StatelessWidget {
6364
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10),
6465
child: Row(
6566
children: [
66-
Text(
67-
'CODEINE',
68-
style:
69-
Theme.of(context).textTheme.headline3.copyWith(fontSize: 25),
67+
SizedBox(
68+
width: 250.0,
69+
child: DefaultTextStyle(
70+
style: Theme.of(context).textTheme.headline3.copyWith(
71+
fontSize: 25,
72+
shadows: [
73+
Shadow(
74+
blurRadius: 7.0,
75+
color: Theme.of(context).focusColor,
76+
offset: Offset(0, 0),
77+
),
78+
],
79+
),
80+
child: AnimatedTextKit(
81+
repeatForever: true,
82+
animatedTexts: [
83+
FlickerAnimatedText(
84+
'CODEINE',
85+
speed: Duration(seconds: 8),
86+
),
87+
],
88+
pause: Duration(milliseconds: 0),
89+
onTap: () {
90+
print("Tap Event");
91+
},
92+
),
93+
),
7094
),
95+
// SizedBox(
96+
// width: 250.0,
97+
// child: AnimatedTextKit(
98+
// animatedTexts: [
99+
// ColorizeAnimatedText(
100+
// 'CODEINE',
101+
// textStyle: Theme.of(context)
102+
// .textTheme
103+
// .headline3
104+
// .copyWith(fontSize: 25),
105+
// colors: [
106+
// Theme.of(context).focusColor,
107+
// Theme.of(context).splashColor,
108+
// ],
109+
// speed: Duration(seconds: 2),
110+
// ),
111+
// ColorizeAnimatedText(
112+
// 'CODEINE',
113+
// textStyle: Theme.of(context)
114+
// .textTheme
115+
// .headline3
116+
// .copyWith(fontSize: 25),
117+
// colors: [
118+
// Theme.of(context).focusColor,
119+
// Theme.of(context).splashColor,
120+
// ],
121+
// speed: Duration(seconds: 2),
122+
// ),
123+
// ],
124+
// isRepeatingAnimation: true,
125+
// repeatForever: true,
126+
// pause: Duration(milliseconds: 100),
127+
// onTap: () {
128+
// print("Tap Event");
129+
// },
130+
// ),
131+
// ),
132+
// Text(
133+
// 'CODEINE',
134+
// style:
135+
// Theme.of(context).textTheme.headline3.copyWith(fontSize: 25),
136+
// ),
71137
Spacer(),
72138
CircleAvatar(
73139
radius: 20,

lib/widgets/song_card.dart

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,23 @@ class SongCard extends StatelessWidget {
2424
width: double.infinity,
2525
child: Row(
2626
children: [
27-
Container(
28-
height: 62,
29-
width: 62,
30-
decoration: BoxDecoration(
31-
color: Colors.transparent,
32-
borderRadius: BorderRadius.circular(19.0),
33-
image: DecorationImage(
34-
image: NetworkImage(
35-
song.imageUrl,
27+
Stack(
28+
children: [
29+
Container(
30+
height: 62,
31+
width: 62,
32+
decoration: BoxDecoration(
33+
color: Colors.transparent,
34+
borderRadius: BorderRadius.circular(19.0),
35+
image: DecorationImage(
36+
image: NetworkImage(
37+
song.imageUrl,
38+
),
39+
),
3640
),
3741
),
38-
),
42+
43+
],
3944
),
4045
SizedBox(width: 20),
4146
Container(
@@ -69,8 +74,8 @@ class SongCard extends StatelessWidget {
6974
Text(
7075
song.duration,
7176
style: Theme.of(context).textTheme.bodyText2.copyWith(
72-
color: Theme.of(context).disabledColor,
73-
),
77+
color: Theme.of(context).disabledColor,
78+
),
7479
overflow: TextOverflow.ellipsis,
7580
),
7681
],

lib/widgets/top_music_player.dart

Lines changed: 66 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
part of 'music_player.dart';
22

3-
class TopMusicPlayer extends StatelessWidget {
3+
class TopMusicPlayer extends StatefulWidget {
4+
@override
5+
State<TopMusicPlayer> createState() => _TopMusicPlayerState();
6+
}
7+
8+
class _TopMusicPlayerState extends State<TopMusicPlayer>
9+
with TickerProviderStateMixin {
10+
AnimationController _controller;
11+
Tween<double> _tween = Tween(begin: 0.75, end: 1);
12+
13+
@override
14+
void initState() {
15+
super.initState();
16+
_controller = AnimationController(
17+
duration: const Duration(seconds: 1), vsync: this);
18+
_controller.repeat(reverse: true);
19+
}
20+
21+
@override
22+
void dispose() {
23+
_controller.dispose();
24+
super.dispose();
25+
}
26+
427
@override
528
Widget build(BuildContext context) {
629
Size size = MediaQuery.of(context).size;
@@ -43,13 +66,40 @@ class TopMusicPlayer extends StatelessWidget {
4366
],
4467
),
4568
Spacer(),
46-
CircleAvatar(
47-
radius: 125.5,
48-
backgroundColor: Theme.of(context).focusColor.withOpacity(0.25),
49-
child: CircleAvatar(
50-
radius: 107.5,
51-
backgroundImage:
52-
NetworkImage(GlobalParameters.currentSong.value.imageUrl),
69+
Container(
70+
alignment: Alignment.center,
71+
height: 250,
72+
width: 250,
73+
child: Stack(
74+
children: [
75+
// ScaleTransition(
76+
// scale: _tween.animate(
77+
// CurvedAnimation(
78+
// parent: _controller, curve: Curves.elasticOut),
79+
// ),
80+
// child: Container(
81+
// height: 250,
82+
// width: 250,
83+
// child: Container(
84+
// height: 250,
85+
// width: 250,
86+
// decoration: BoxDecoration(
87+
// color: Theme.of(context).focusColor.withOpacity(0.25),
88+
// shape: BoxShape.circle,
89+
// ),
90+
// ),
91+
// ),
92+
// ),
93+
Container(
94+
alignment: Alignment.center,
95+
child: CircleAvatar(
96+
radius: 107.5,
97+
backgroundColor: Theme.of(context).focusColor,
98+
backgroundImage: NetworkImage(
99+
GlobalParameters.currentSong.value.imageUrl),
100+
),
101+
),
102+
],
53103
),
54104
),
55105
SizedBox(height: 30),
@@ -111,14 +161,14 @@ class TopMusicPlayer extends StatelessWidget {
111161
Padding(
112162
padding: const EdgeInsets.only(top: 10),
113163
child: FutureBuilder(
114-
future: GlobalParameters.currentSong.value.generateColors(),
115-
builder: (context, snapshot) {
116-
return SongSlider(
117-
firstColor: GlobalParameters.currentSong.value.firstColor,
118-
secondColor: GlobalParameters.currentSong.value.secondColor,
119-
);
120-
}
121-
),
164+
future: GlobalParameters.currentSong.value.generateColors(),
165+
builder: (context, snapshot) {
166+
return SongSlider(
167+
firstColor: GlobalParameters.currentSong.value.firstColor,
168+
secondColor:
169+
GlobalParameters.currentSong.value.secondColor,
170+
);
171+
}),
122172
),
123173
ValueListenableBuilder(
124174
valueListenable: GlobalParameters.songSeconds,

pubspec.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Generated by pub
22
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
4+
animated_text_kit:
5+
dependency: "direct main"
6+
description:
7+
name: animated_text_kit
8+
url: "https://pub.dartlang.org"
9+
source: hosted
10+
version: "4.2.1"
411
archive:
512
dependency: transitive
613
description:

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ dependencies:
3737
sqflite: ^2.0.0+3
3838
snapping_sheet: ^3.1.0
3939
palette_generator: ^0.3.0
40+
animated_text_kit: ^4.2.1
4041

4142
dev_dependencies:
4243
flutter_test:

0 commit comments

Comments
 (0)