Skip to content

Commit

Permalink
fix: empty queue while switching to yt queue
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Oct 29, 2023
1 parent da04489 commit e3f79bf
Showing 1 changed file with 61 additions and 57 deletions.
118 changes: 61 additions & 57 deletions lib/packages/miniplayer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ class NamidaMiniPlayer extends StatelessWidget {
final currentIndex = Player.inst.currentIndex;
final indminus = refine(currentIndex - 1);
final indplus = refine(currentIndex + 1);
final prevTrack = Player.inst.currentQueue[indminus];
final prevTrack = Player.inst.currentQueue.isEmpty ? null : Player.inst.currentQueue[indminus];
final currentTrack = Player.inst.nowPlayingTrack;
final nextTrack = Player.inst.currentQueue[indplus];
final nextTrack = Player.inst.currentQueue.isEmpty ? null : Player.inst.currentQueue[indplus];
final currentDuration = currentTrack.duration;
final currentDurationInMS = currentDuration * 1000;
return Stack(
Expand Down Expand Up @@ -1078,20 +1078,21 @@ class NamidaMiniPlayer extends StatelessWidget {
builder: (context, child) {
return Stack(
children: [
Opacity(
opacity: -sAnim.value.clamp(-1.0, 0.0),
child: Transform.translate(
offset: Offset(-sAnim.value * sMaxOffset / siParallax - sMaxOffset / siParallax, 0),
child: _TrackInfo(
trackPre: prevTrack.track,
p: bp,
cp: bcp,
bottomOffset: bottomOffset,
maxOffset: maxOffset,
screenSize: screenSize,
if (prevTrack != null)
Opacity(
opacity: -sAnim.value.clamp(-1.0, 0.0),
child: Transform.translate(
offset: Offset(-sAnim.value * sMaxOffset / siParallax - sMaxOffset / siParallax, 0),
child: _TrackInfo(
trackPre: prevTrack.track,
p: bp,
cp: bcp,
bottomOffset: bottomOffset,
maxOffset: maxOffset,
screenSize: screenSize,
),
),
),
),
Opacity(
opacity: 1 - sAnim.value.abs(),
child: Transform.translate(
Expand All @@ -1113,20 +1114,21 @@ class NamidaMiniPlayer extends StatelessWidget {
),
),
),
Opacity(
opacity: sAnim.value.clamp(0.0, 1.0),
child: Transform.translate(
offset: Offset(-sAnim.value * sMaxOffset / siParallax + sMaxOffset / siParallax, 0),
child: _TrackInfo(
trackPre: nextTrack.track,
p: bp,
cp: bcp,
bottomOffset: bottomOffset,
maxOffset: maxOffset,
screenSize: screenSize,
if (nextTrack != null)
Opacity(
opacity: sAnim.value.clamp(0.0, 1.0),
child: Transform.translate(
offset: Offset(-sAnim.value * sMaxOffset / siParallax + sMaxOffset / siParallax, 0),
child: _TrackInfo(
trackPre: nextTrack.track,
p: bp,
cp: bcp,
bottomOffset: bottomOffset,
maxOffset: maxOffset,
screenSize: screenSize,
),
),
),
)
)
],
);
},
Expand All @@ -1143,24 +1145,25 @@ class NamidaMiniPlayer extends StatelessWidget {

return Stack(
children: [
Opacity(
opacity: -sAnim.value.clamp(-1.0, 0.0),
child: Transform.translate(
offset: Offset(-sAnim.value * sMaxOffset / siParallax - sMaxOffset / siParallax, 0),
child: _RawImageContainer(
cp: bcp,
p: bp,
width: width,
screenSize: screenSize,
bottomOffset: bottomOffset,
maxOffset: maxOffset,
child: _TrackImage(
track: prevTrack.track,
cp: cp,
if (prevTrack != null)
Opacity(
opacity: -sAnim.value.clamp(-1.0, 0.0),
child: Transform.translate(
offset: Offset(-sAnim.value * sMaxOffset / siParallax - sMaxOffset / siParallax, 0),
child: _RawImageContainer(
cp: bcp,
p: bp,
width: width,
screenSize: screenSize,
bottomOffset: bottomOffset,
maxOffset: maxOffset,
child: _TrackImage(
track: prevTrack.track,
cp: cp,
),
),
),
),
),
Opacity(
opacity: 1 - sAnim.value.abs(),
child: Transform.translate(
Expand All @@ -1180,24 +1183,25 @@ class NamidaMiniPlayer extends StatelessWidget {
),
),
),
Opacity(
opacity: sAnim.value.clamp(0.0, 1.0),
child: Transform.translate(
offset: Offset(-sAnim.value * sMaxOffset / siParallax + sMaxOffset / siParallax, 0),
child: _RawImageContainer(
cp: bcp,
p: bp,
width: width,
screenSize: screenSize,
bottomOffset: bottomOffset,
maxOffset: maxOffset,
child: _TrackImage(
track: nextTrack.track,
cp: cp,
if (nextTrack != null)
Opacity(
opacity: sAnim.value.clamp(0.0, 1.0),
child: Transform.translate(
offset: Offset(-sAnim.value * sMaxOffset / siParallax + sMaxOffset / siParallax, 0),
child: _RawImageContainer(
cp: bcp,
p: bp,
width: width,
screenSize: screenSize,
bottomOffset: bottomOffset,
maxOffset: maxOffset,
child: _TrackImage(
track: nextTrack.track,
cp: cp,
),
),
),
),
),
],
);
},
Expand Down

0 comments on commit e3f79bf

Please sign in to comment.