-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add playlists to localaudio view and search (#980)
- Loading branch information
1 parent
13fefb6
commit 5293dca
Showing
16 changed files
with
170 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:watch_it/watch_it.dart'; | ||
import 'package:yaru/yaru.dart'; | ||
|
||
import '../../common/view/icons.dart'; | ||
import '../../common/view/round_image_container.dart'; | ||
import '../../constants.dart'; | ||
import '../../extensions/build_context_x.dart'; | ||
import '../../library/library_model.dart'; | ||
import '../../playlists/view/manual_add_dialog.dart'; | ||
import '../../playlists/view/playlist_page.dart'; | ||
|
||
class PlaylistsView extends StatelessWidget { | ||
const PlaylistsView({ | ||
super.key, | ||
this.noResultMessage, | ||
this.noResultIcon, | ||
required this.playlists, | ||
}); | ||
|
||
final List<String>? playlists; | ||
final Widget? noResultMessage, noResultIcon; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final lists = [ | ||
kNewPlaylistPageId, | ||
...(playlists ?? []), | ||
]; | ||
|
||
return SliverGrid.builder( | ||
itemCount: lists.length, | ||
gridDelegate: kDiskGridDelegate, | ||
itemBuilder: (context, index) { | ||
final id = lists.elementAt(index); | ||
return YaruSelectableContainer( | ||
selected: false, | ||
onTap: () => id == kNewPlaylistPageId | ||
? showDialog( | ||
context: context, | ||
builder: (context) => const ManualAddDialog(), | ||
) | ||
: di<LibraryModel>().push( | ||
builder: (_) => PlaylistPage( | ||
pageId: id, | ||
), | ||
pageId: id, | ||
), | ||
borderRadius: BorderRadius.circular(300), | ||
child: Stack( | ||
alignment: Alignment.center, | ||
children: [ | ||
SizedBox( | ||
width: double.infinity, | ||
height: double.infinity, | ||
child: id == kNewPlaylistPageId | ||
? Container( | ||
decoration: BoxDecoration( | ||
color: context.colorScheme.surface.scale( | ||
lightness: context.colorScheme.isDark ? 0.1 : -0.1, | ||
), | ||
shape: BoxShape.circle, | ||
), | ||
child: Icon(Iconz.plus), | ||
) | ||
: RoundImageContainer( | ||
images: const {}, | ||
fallBackText: id, | ||
), | ||
), | ||
if (id != kNewPlaylistPageId) ArtistVignette(text: id), | ||
], | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.