feat: shuffle keep playing track at top, linux title bar drag no working

This commit is contained in:
Kingkor Roy Tirtho 2022-11-24 13:49:40 +06:00
parent 00d0d38b54
commit 1223cf2629
4 changed files with 25 additions and 16 deletions

View File

@ -207,28 +207,28 @@ class Settings extends HookConsumerWidget {
leading: const Icon(Icons.ad_units_rounded),
title: const PlatformText("Mimic Platform"),
trailing: (context, update) =>
PlatformDropDownMenu<TargetPlatform>(
DropdownButton<TargetPlatform>(
value: Spotube.of(context).appPlatform,
items: [
PlatformDropDownMenuItem(
items: const [
DropdownMenuItem(
value: TargetPlatform.android,
child: const PlatformText("Android (Material You)"),
child: PlatformText("Android (Material You)"),
),
PlatformDropDownMenuItem(
DropdownMenuItem(
value: TargetPlatform.iOS,
child: const PlatformText("iOS (Cupertino)"),
child: PlatformText("iOS (Cupertino)"),
),
PlatformDropDownMenuItem(
DropdownMenuItem(
value: TargetPlatform.macOS,
child: const PlatformText("macOS (Aqua)"),
child: PlatformText("macOS (Aqua)"),
),
PlatformDropDownMenuItem(
DropdownMenuItem(
value: TargetPlatform.linux,
child: const PlatformText("Linux (GTK+Libadwaita)"),
child: PlatformText("Linux (GTK+Libadwaita)"),
),
PlatformDropDownMenuItem(
DropdownMenuItem(
value: TargetPlatform.windows,
child: const PlatformText("Windows 11 (Fluent UI)"),
child: PlatformText("Windows 11 (Fluent UI)"),
),
],
onChanged: (value) {

View File

@ -23,9 +23,14 @@ class PageWindowTitleBar extends PlatformAppBar {
}) : super(
actions: [
...?actions,
if (!kIsMacOS && !kIsMobile) const PlatformWindowButtons(),
if (!kIsMacOS && !kIsMobile)
platform == TargetPlatform.linux
? MoveWindow(child: const PlatformWindowButtons())
: const PlatformWindowButtons(),
],
title: center,
title: platform == TargetPlatform.linux
? MoveWindow(child: Center(child: center))
: center,
);
@override

View File

@ -90,11 +90,15 @@ class CurrentPlaylist {
List<String> get trackIds => tracks.map((e) => e.id!).toList();
bool shuffle() {
bool shuffle(Track? topTrack) {
// won't shuffle if already shuffled
if (_tempTrack == null) {
_tempTrack = [...tracks];
tracks.shuffle();
if (topTrack != null) {
tracks.remove(topTrack);
tracks.insert(0, topTrack);
}
return true;
}
return false;

View File

@ -290,7 +290,7 @@ class Playback extends PersistedChangeNotifier {
switch (playbackMode) {
case PlaybackMode.normal:
playbackMode = PlaybackMode.shuffle;
playlist?.shuffle();
playlist?.shuffle(track);
break;
case PlaybackMode.shuffle:
playbackMode = PlaybackMode.repeat;