Skip to content

Commit e53a3cc

Browse files
committed
🚧 refomat code
1 parent 6c64e48 commit e53a3cc

File tree

12 files changed

+34
-72
lines changed

12 files changed

+34
-72
lines changed

lib/common/widgets/appbar/app_bar.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ class BasicAppBar extends StatelessWidget implements PreferredSizeWidget {
3434
height: 50,
3535
width: 50,
3636
decoration: BoxDecoration(
37-
color: context.isDarkMode
38-
? AppColors.white.withOpacity(0.03)
39-
: AppColors.dark.withOpacity(0.04),
37+
color: context.isDarkMode ? AppColors.white.withOpacity(0.03) : AppColors.dark.withOpacity(0.04),
4038
shape: BoxShape.circle,
4139
),
4240
child: Icon(

lib/core/constants/app_urls.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
class AppUrls {
2-
static const coverFireStorage =
3-
'https://firebasestorage.googleapis.com/v0/b/spotify-flutter-4aa82.appspot.com/o/covers%2F';
4-
static const songFireStorage =
5-
'https://firebasestorage.googleapis.com/v0/b/spotify-flutter-4aa82.appspot.com/o/covers%2F';
2+
static const coverFireStorage = 'https://firebasestorage.googleapis.com/v0/b/spotify-flutter-4aa82.appspot.com/o/covers%2F';
3+
static const songFireStorage = 'https://firebasestorage.googleapis.com/v0/b/spotify-flutter-4aa82.appspot.com/o/covers%2F';
64
static const temp = 'Son-Tung-';
75
static const mediaAlt = 'alt=media';
86
}

lib/data/sources/song/song_firebase_service.dart

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ class SongFirebaseServiceImpl extends SongFirebaseService {
1414
Future<Either> getNewsSongs() async {
1515
try {
1616
List<SongEntity> songs = [];
17-
var data = await FirebaseFirestore.instance
18-
.collection('Songs')
19-
.orderBy('releaseDate', descending: true)
20-
.limit(3)
21-
.get();
17+
var data = await FirebaseFirestore.instance.collection('Songs').orderBy('releaseDate', descending: true).limit(3).get();
2218

2319
for (var element in data.docs) {
2420
var songModel = SongModel.fromJson(element.data());
@@ -38,10 +34,7 @@ class SongFirebaseServiceImpl extends SongFirebaseService {
3834
Future<Either> getPlayList() async {
3935
try {
4036
List<SongEntity> songs = [];
41-
var data = await FirebaseFirestore.instance
42-
.collection('Songs')
43-
.orderBy('releaseDate', descending: true)
44-
.get();
37+
var data = await FirebaseFirestore.instance.collection('Songs').orderBy('releaseDate', descending: true).get();
4538

4639
for (var element in data.docs) {
4740
var songModel = SongModel.fromJson(element.data());

lib/main.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ import 'package:spotify_with_flutter/service_locator.dart';
1313
Future<void> main() async {
1414
WidgetsFlutterBinding.ensureInitialized();
1515
HydratedBloc.storage = await HydratedStorage.build(
16-
storageDirectory: kIsWeb
17-
? HydratedStorage.webStorageDirectory
18-
: await getApplicationDocumentsDirectory(),
16+
storageDirectory: kIsWeb ? HydratedStorage.webStorageDirectory : await getApplicationDocumentsDirectory(),
1917
);
2018
await Firebase.initializeApp(
2119
options: DefaultFirebaseOptions.currentPlatform,

lib/presentation/auth/pages/signup_or_signin.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ class SignupOrSignin extends StatelessWidget {
4646
'Enjoy Listening To Music',
4747
style: TextStyle(
4848
fontWeight: FontWeight.bold,
49-
color:
50-
context.isDarkMode ? AppColors.white : AppColors.dark,
49+
color: context.isDarkMode ? AppColors.white : AppColors.dark,
5150
fontSize: 29,
5251
),
5352
),
@@ -58,9 +57,7 @@ class SignupOrSignin extends StatelessWidget {
5857
'Spotify is a proprietary Swedish audio streaming and media services provider',
5958
style: TextStyle(
6059
fontWeight: FontWeight.w400,
61-
color: context.isDarkMode
62-
? AppColors.greyTitle
63-
: AppColors.grey,
60+
color: context.isDarkMode ? AppColors.greyTitle : AppColors.grey,
6461
fontSize: 19,
6562
),
6663
textAlign: TextAlign.center,
@@ -96,9 +93,7 @@ class SignupOrSignin extends StatelessWidget {
9693
"Sign In",
9794
style: TextStyle(
9895
fontWeight: FontWeight.w500,
99-
color: context.isDarkMode
100-
? AppColors.white
101-
: AppColors.dark,
96+
color: context.isDarkMode ? AppColors.white : AppColors.dark,
10297
fontSize: 21,
10398
),
10499
),

lib/presentation/choose_mode/pages/choose_mode.dart

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ class _ChooseModePageState extends State<ChooseModePage> {
4242
color: Colors.black.withOpacity(0.5),
4343
),
4444
Padding(
45-
padding:
46-
const EdgeInsets.symmetric(vertical: 50.0, horizontal: 40.0),
45+
padding: const EdgeInsets.symmetric(vertical: 50.0, horizontal: 40.0),
4746
child: Column(
4847
children: [
4948
Align(
@@ -70,9 +69,7 @@ class _ChooseModePageState extends State<ChooseModePage> {
7069
children: [
7170
GestureDetector(
7271
onTap: () {
73-
context
74-
.read<ThemeCubit>()
75-
.updateTheme(ThemeMode.dark);
72+
context.read<ThemeCubit>().updateTheme(ThemeMode.dark);
7673
},
7774
child: ClipOval(
7875
child: BackdropFilter(
@@ -108,9 +105,7 @@ class _ChooseModePageState extends State<ChooseModePage> {
108105
children: [
109106
GestureDetector(
110107
onTap: () {
111-
context
112-
.read<ThemeCubit>()
113-
.updateTheme(ThemeMode.light);
108+
context.read<ThemeCubit>().updateTheme(ThemeMode.light);
114109
},
115110
child: ClipOval(
116111
child: BackdropFilter(
@@ -153,8 +148,7 @@ class _ChooseModePageState extends State<ChooseModePage> {
153148
Navigator.push(
154149
context,
155150
MaterialPageRoute(
156-
builder: (BuildContext context) =>
157-
const SignupOrSignin(),
151+
builder: (BuildContext context) => const SignupOrSignin(),
158152
),
159153
);
160154
},

lib/presentation/home/pages/home.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
7272
height: 50,
7373
width: 50,
7474
decoration: BoxDecoration(
75-
color: context.isDarkMode
76-
? AppColors.white.withOpacity(0.03)
77-
: AppColors.dark.withOpacity(0.04),
75+
color: context.isDarkMode ? AppColors.white.withOpacity(0.03) : AppColors.dark.withOpacity(0.04),
7876
shape: BoxShape.circle,
7977
),
8078
child: Icon(

lib/presentation/home/widgets/news_songs.dart

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ class NewsSongs extends StatelessWidget {
2020
child: BlocBuilder<NewsSongsCubit, NewsSongsState>(
2121
builder: (context, state) {
2222
if (state is NewsSongsLoading) {
23-
return Container(
24-
alignment: Alignment.center,
25-
child: const CircularProgressIndicator());
23+
return Container(alignment: Alignment.center, child: const CircularProgressIndicator());
2624
}
2725

2826
if (state is NewsSongsLoaded) {
@@ -77,15 +75,12 @@ class NewsSongs extends StatelessWidget {
7775
width: 30,
7876
transform: Matrix4.translationValues(-10, 10, 0),
7977
decoration: BoxDecoration(
80-
shape: BoxShape.circle,
81-
color: context.isDarkMode
82-
? AppColors.darkGrey
83-
: const Color(0xffE6E6E6)),
78+
shape: BoxShape.circle,
79+
color: context.isDarkMode ? AppColors.darkGrey : const Color(0xffE6E6E6),
80+
),
8481
child: Icon(
8582
Icons.play_arrow_rounded,
86-
color: context.isDarkMode
87-
? const Color(0xff959595)
88-
: const Color(0xff555555),
83+
color: context.isDarkMode ? const Color(0xff959595) : const Color(0xff555555),
8984
),
9085
),
9186
),
@@ -112,8 +107,7 @@ class NewsSongs extends StatelessWidget {
112107
padding: const EdgeInsets.only(left: 6.0),
113108
child: Text(
114109
songs[index].artist,
115-
style: const TextStyle(
116-
fontWeight: FontWeight.w400, fontSize: 12),
110+
style: const TextStyle(fontWeight: FontWeight.w400, fontSize: 12),
117111
),
118112
)
119113
],

lib/presentation/home/widgets/play_list.dart

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ class PlayList extends StatelessWidget {
1818
child: BlocBuilder<PlayListCubit, PlayListState>(
1919
builder: (context, state) {
2020
if (state is PlayListLoading) {
21-
return Container(
22-
alignment: Alignment.center,
23-
child: const CircularProgressIndicator());
21+
return Container(alignment: Alignment.center, child: const CircularProgressIndicator());
2422
}
2523

2624
if (state is PlayListLoaded) {
@@ -90,15 +88,11 @@ class PlayList extends StatelessWidget {
9088
width: 40,
9189
decoration: BoxDecoration(
9290
shape: BoxShape.circle,
93-
color: context.isDarkMode
94-
? AppColors.darkGrey
95-
: AppColors.greyWhite,
91+
color: context.isDarkMode ? AppColors.darkGrey : AppColors.greyWhite,
9692
),
9793
child: Icon(
9894
Icons.play_arrow_rounded,
99-
color: context.isDarkMode
100-
? AppColors.white
101-
: AppColors.darkGrey,
95+
color: context.isDarkMode ? AppColors.white : AppColors.darkGrey,
10296
),
10397
),
10498
const SizedBox(width: 10),

lib/presentation/intro/pages/get_started.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ class GetStartedPage extends StatelessWidget {
3333
color: Colors.black.withOpacity(0.5),
3434
),
3535
Padding(
36-
padding:
37-
const EdgeInsets.symmetric(vertical: 50.0, horizontal: 40.0),
36+
padding: const EdgeInsets.symmetric(vertical: 50.0, horizontal: 40.0),
3837
child: Column(
3938
children: [
4039
Align(
@@ -70,8 +69,7 @@ class GetStartedPage extends StatelessWidget {
7069
Navigator.push(
7170
context,
7271
MaterialPageRoute(
73-
builder: (BuildContext context) =>
74-
const ChooseModePage(),
72+
builder: (BuildContext context) => const ChooseModePage(),
7573
),
7674
);
7775
},

0 commit comments

Comments
 (0)