Skip to content

Commit

Permalink
Improve: Improved mini player
Browse files Browse the repository at this point in the history
(Swipe left to skip to the previous track and swipe right to skip to the next track)
  • Loading branch information
gokadzev committed Dec 20, 2023
1 parent 55c657e commit b3dfdca
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/75.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bug fixes


Enhancements

- Improved mini player (Swipe left to skip to the previous track and swipe right to skip to the next track)
- Made various quality and performance improvements for app stability and speed
19 changes: 19 additions & 0 deletions lib/widgets/mini_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class MiniPlayer extends StatelessWidget {

@override
Widget build(BuildContext context) {
var _isHandlingSwipe = false;

return GestureDetector(
onVerticalDragUpdate: (details) {
if (details.primaryDelta! < 0) {
Expand All @@ -25,6 +27,23 @@ class MiniPlayer extends StatelessWidget {
);
}
},
onHorizontalDragUpdate: (details) {
if (details.primaryDelta! > 0) {
if (!_isHandlingSwipe) {
_isHandlingSwipe = true;
audioHandler.skipToPrevious().whenComplete(() {
_isHandlingSwipe = false;
});
}
} else if (details.primaryDelta! < 0) {
if (!_isHandlingSwipe) {
_isHandlingSwipe = true;
audioHandler.skipToNext().whenComplete(() {
_isHandlingSwipe = false;
});
}
}
},
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
height: 75,
Expand Down

0 comments on commit b3dfdca

Please sign in to comment.