diff --git a/graphics/default.png b/graphics/default.png new file mode 100644 index 0000000..2b46b62 Binary files /dev/null and b/graphics/default.png differ diff --git a/lib/main.dart b/lib/main.dart index fe6b31d..a136391 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,7 +9,9 @@ import 'package:flutter_slidable/flutter_slidable.dart'; import 'screens/browser.dart'; import 'singletons/server_list.dart'; import 'objects/server.dart'; +import 'objects/metadata.dart'; import 'screens/about_screen.dart'; +import 'screens/metadata_screen.dart'; import 'screens/auto_dj.dart'; import 'screens/downloads.dart'; import 'singletons/downloads.dart'; @@ -310,6 +312,33 @@ class NowPlaying extends StatelessWidget { .removeQueueItemAt(index); }, ), + secondaryActions: [ + IconSlideAction( + color: Colors.blueGrey, + icon: Icons.info, + caption: 'Info', + onTap: () { + MusicMetadata m = new MusicMetadata( + queue[index].artist, + queue[index].album, + queue[index].title, + null, + null, + queue[index].extras?['year'], + 'X', + null, + queue[index].artUri?.toString()); + print(queue[index]); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + MeteDataScreen( + meta: m, + path: queue[index] + .extras?['path']))); + }), + ], actions: [ // IconSlideAction( // color: Colors.blueGrey, diff --git a/lib/media/audio_stuff.dart b/lib/media/audio_stuff.dart index a4a5b31..136d352 100644 --- a/lib/media/audio_stuff.dart +++ b/lib/media/audio_stuff.dart @@ -320,7 +320,10 @@ class AudioPlayerHandler extends BaseAudioHandler (autoDJServer?.jwt ?? '')) : Uri.parse(autoDJServer!.url.toString()) .resolve('/assets/img/default.png'), - extras: {'path': decoded['songs'][0]['filepath']}); + extras: { + 'path': decoded['songs'][0]['filepath'], + 'year': decoded['songs'][0]['year'] + }); jsonAutoDJIgnoreList = decoded['ignoreList']; diff --git a/lib/objects/display_item.dart b/lib/objects/display_item.dart index 7dde687..11e5bfd 100644 --- a/lib/objects/display_item.dart +++ b/lib/objects/display_item.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:path_provider/path_provider.dart'; import 'server.dart'; import 'metadata.dart'; diff --git a/lib/screens/browser.dart b/lib/screens/browser.dart index 3a100bb..e1134ff 100644 --- a/lib/screens/browser.dart +++ b/lib/screens/browser.dart @@ -144,7 +144,11 @@ class Browser extends StatelessWidget { (i.server!.jwt ?? '')) : Uri.parse(i.server!.url.toString()) .resolve('/assets/img/default.png'), - extras: {'path': i.data, 'localPath': finalString}); + extras: { + 'path': i.data, + 'localPath': finalString, + 'year': i.metadata?.year + }); MediaManager().audioHandler.addQueueItem(item); return; } @@ -179,7 +183,11 @@ class Browser extends StatelessWidget { (i.server!.jwt ?? '')) : Uri.parse(i.server!.url.toString()) .resolve('/assets/img/default.png'), - extras: {'server': i.server!.localname, 'path': i.data}); + extras: { + 'server': i.server!.localname, + 'path': i.data, + 'year': i.metadata?.year + }); MediaManager().audioHandler.addQueueItem(item); diff --git a/lib/screens/metadata_screen.dart b/lib/screens/metadata_screen.dart new file mode 100644 index 0000000..71dc6f9 --- /dev/null +++ b/lib/screens/metadata_screen.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import '../objects/metadata.dart'; + +class MeteDataScreen extends StatelessWidget { + // In the constructor, require a Todo. + const MeteDataScreen({Key? key, required this.meta, required this.path}) + : super(key: key); + + // Declare a field that holds the Todo. + final MusicMetadata meta; + + final String? path; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Color(0xFF3f3f3f), + appBar: AppBar( + title: Text("Song Info"), + ), + body: Container( + // padding: EdgeInsets.all(20.0), + child: ListView(children: [ + if (meta.albumArt != null) ...[Image.network(meta.albumArt!)], + Container(height: 20), + if (meta.title != null) ...[ + Container( + padding: EdgeInsets.symmetric(horizontal: 20.0), + child: Text(meta.title!)), + ], + if (meta.artist != null) ...[ + Container( + padding: EdgeInsets.symmetric(horizontal: 20.0), + child: Text(meta.artist!)) + ], + if (meta.album != null) ...[ + Container( + padding: EdgeInsets.symmetric(horizontal: 20.0), + child: Text(meta.album!)), + ], + if (meta.year != null) ...[ + Container( + padding: EdgeInsets.symmetric(horizontal: 20.0), + child: Text(meta.year!.toString())) + ], + Container(height: 20), + if (path != null) ...[ + Container( + padding: EdgeInsets.symmetric(horizontal: 20.0), + child: Text(path!)) + ] + ]))); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 7a47a8c..ed8a837 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -54,6 +54,7 @@ flutter_icons: flutter: assets: - graphics/mstream-logo.png + - graphics/default.png # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class.