Skip to content

Commit

Permalink
Improve: Improved shuffle and repeat buttons on now playing page
Browse files Browse the repository at this point in the history
  • Loading branch information
gokadzev committed May 30, 2024
1 parent 9732974 commit ef09224
Showing 1 changed file with 50 additions and 30 deletions.
80 changes: 50 additions & 30 deletions lib/screens/now_playing_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,22 +286,31 @@ class NowPlayingPage extends StatelessWidget {
ValueListenableBuilder<bool>(
valueListenable: shuffleNotifier,
builder: (_, value, __) {
return IconButton.filled(
icon: Icon(
value
? FluentIcons.arrow_shuffle_24_filled
: FluentIcons.arrow_shuffle_off_24_filled,
color: _secondaryColor,
),
iconSize: iconSize,
onPressed: () {
audioHandler.setShuffleMode(
value
? AudioServiceShuffleMode.none
: AudioServiceShuffleMode.all,
);
},
);
return value
? IconButton.filled(
icon: Icon(
FluentIcons.arrow_shuffle_24_filled,
color: _secondaryColor,
),
iconSize: iconSize,
onPressed: () {
audioHandler.setShuffleMode(
AudioServiceShuffleMode.none,
);
},
)
: IconButton.filledTonal(
icon: Icon(
FluentIcons.arrow_shuffle_off_24_filled,
color: _primaryColor,
),
iconSize: iconSize,
onPressed: () {
audioHandler.setShuffleMode(
AudioServiceShuffleMode.all,
);
},
);
},
),
Row(
Expand Down Expand Up @@ -346,20 +355,31 @@ class NowPlayingPage extends StatelessWidget {
ValueListenableBuilder<bool>(
valueListenable: repeatNotifier,
builder: (_, value, __) {
return IconButton.filled(
icon: Icon(
value
? FluentIcons.arrow_repeat_1_24_filled
: FluentIcons.arrow_repeat_all_off_24_filled,
color: _secondaryColor,
),
iconSize: iconSize,
onPressed: () => audioHandler.setRepeatMode(
value
? AudioServiceRepeatMode.none
: AudioServiceRepeatMode.all,
),
);
return value
? IconButton.filled(
icon: Icon(
FluentIcons.arrow_repeat_1_24_filled,
color: _secondaryColor,
),
iconSize: iconSize,
onPressed: () {
audioHandler.setRepeatMode(
AudioServiceRepeatMode.none,
);
},
)
: IconButton.filledTonal(
icon: Icon(
FluentIcons.arrow_repeat_all_off_24_filled,
color: _primaryColor,
),
iconSize: iconSize,
onPressed: () {
audioHandler.setRepeatMode(
AudioServiceRepeatMode.all,
);
},
);
},
),
],
Expand Down

0 comments on commit ef09224

Please sign in to comment.