Skip to content

Commit

Permalink
Improved code
Browse files Browse the repository at this point in the history
  • Loading branch information
gokadzev committed Dec 14, 2023
1 parent 858e484 commit fc357ef
Showing 1 changed file with 68 additions and 66 deletions.
134 changes: 68 additions & 66 deletions lib/screens/now_playing_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,34 +207,35 @@ class NowPlayingPage extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
children: [
ValueListenableBuilder<bool>(
valueListenable: muteNotifier,
builder: (_, value, __) {
return customIconButton(
value
? FluentIcons.speaker_mute_24_filled
: FluentIcons.speaker_mute_24_regular,
colorScheme.primary,
20,
audioHandler.mute,
);
},
),
customIconButton(
Icons.add,
colorScheme.primary,
20,
() {
_showAddToPlaylistDialog(
context,
mediaItemToMap(mediaItem),
);
},
),
],
),
if (constraints.maxWidth > 300)
Column(
children: [
ValueListenableBuilder<bool>(
valueListenable: muteNotifier,
builder: (_, value, __) {
return customIconButton(
value
? FluentIcons.speaker_mute_24_filled
: FluentIcons.speaker_mute_24_regular,
colorScheme.primary,
20,
audioHandler.mute,
);
},
),
customIconButton(
Icons.add,
colorScheme.primary,
20,
() {
_showAddToPlaylistDialog(
context,
mediaItemToMap(mediaItem),
);
},
),
],
),
ValueListenableBuilder<bool>(
valueListenable: shuffleNotifier,
builder: (_, value, __) {
Expand Down Expand Up @@ -339,44 +340,45 @@ class NowPlayingPage extends StatelessWidget {
);
},
),
Column(
children: [
ValueListenableBuilder<bool>(
valueListenable: songLikeStatus,
builder: (_, value, __) {
return customIconButton(
value
? FluentIcons.star_24_filled
: FluentIcons.star_24_regular,
songLikeStatus.value
? colorScheme.primary
: colorScheme.primary,
20,
() {
updateSongLikeStatus(
audioId,
!songLikeStatus.value,
);
songLikeStatus.value = !songLikeStatus.value;
},
);
},
),
ValueListenableBuilder<bool>(
valueListenable: playNextSongAutomatically,
builder: (_, value, __) {
return customIconButton(
value
? FluentIcons.music_note_2_play_20_filled
: FluentIcons.music_note_2_play_20_regular,
colorScheme.primary,
20,
audioHandler.changeAutoPlayNextStatus,
);
},
),
],
),
if (constraints.maxWidth > 300)
Column(
children: [
ValueListenableBuilder<bool>(
valueListenable: songLikeStatus,
builder: (_, value, __) {
return customIconButton(
value
? FluentIcons.star_24_filled
: FluentIcons.star_24_regular,
songLikeStatus.value
? colorScheme.primary
: colorScheme.primary,
20,
() {
updateSongLikeStatus(
audioId,
!songLikeStatus.value,
);
songLikeStatus.value = !songLikeStatus.value;
},
);
},
),
ValueListenableBuilder<bool>(
valueListenable: playNextSongAutomatically,
builder: (_, value, __) {
return customIconButton(
value
? FluentIcons.music_note_2_play_20_filled
: FluentIcons.music_note_2_play_20_regular,
colorScheme.primary,
20,
audioHandler.changeAutoPlayNextStatus,
);
},
),
],
),
],
),
),
Expand Down

0 comments on commit fc357ef

Please sign in to comment.