Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed Sep 25, 2023
1 parent 4a5693c commit 2ef5510
Show file tree
Hide file tree
Showing 8 changed files with 552 additions and 487 deletions.
20 changes: 0 additions & 20 deletions lib/components/AlbumScreen/song_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ enum SongListTileMenuItems {
addToQueue,
playNext,
addToNextUp,
replaceQueueWithItem,
addToPlaylist,
removeFromPlaylist,
instantMix,
Expand Down Expand Up @@ -257,13 +256,6 @@ class _SongListTileState extends State<SongListTile> {
title: Text(AppLocalizations.of(context)!.addToNextUp),
),
),
PopupMenuItem<SongListTileMenuItems>(
value: SongListTileMenuItems.replaceQueueWithItem,
child: ListTile(
leading: const Icon(Icons.play_circle),
title: Text(AppLocalizations.of(context)!.replaceQueue),
),
),
widget.isInPlaylist
? PopupMenuItem<SongListTileMenuItems>(
enabled: !isOffline,
Expand Down Expand Up @@ -355,18 +347,6 @@ class _SongListTileState extends State<SongListTile> {
));
break;

case SongListTileMenuItems.replaceQueueWithItem:
// await _audioServiceHelper
// .replaceQueueWithItem(itemList: [widget.item]);
await _queueService.startPlayback(items: [widget.item], source: QueueItemSource(type: QueueItemSourceType.unknown, name: QueueItemSourceName(type: QueueItemSourceNameType.preTranslated, pretranslatedName: AppLocalizations.of(context)!.queue), id: widget.parentId ?? "unknown"));

if (!mounted) return;

ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(AppLocalizations.of(context)!.queueReplaced),
));
break;

case SongListTileMenuItems.addToPlaylist:
Navigator.of(context).pushNamed(AddToPlaylistScreen.routeName,
arguments: widget.item.id);
Expand Down
62 changes: 34 additions & 28 deletions lib/components/PlaybackHistoryScreen/playback_history_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class PlaybackHistoryList extends StatelessWidget {
stream: playbackHistoryService.historyStream,
builder: (context, snapshot) {
if (snapshot.hasData) {

history = snapshot.data;
// groupedHistory = playbackHistoryService.getHistoryGroupedByDate();
groupedHistory = playbackHistoryService.getHistoryGroupedByHour();
Expand All @@ -36,7 +35,6 @@ class PlaybackHistoryList extends StatelessWidget {
return SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {

final actualIndex = group.value.length - index - 1;

final historyItem = Card(
Expand All @@ -49,35 +47,46 @@ class PlaybackHistoryList extends StatelessWidget {
audioServiceHelper: audioServiceHelper,
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(AppLocalizations.of(context)!.startingInstantMix),
content: Text(AppLocalizations.of(context)!
.startingInstantMix),
));

audioServiceHelper.startInstantMixForItem(jellyfin_models.BaseItemDto.fromJson(group.value[actualIndex].item.item.extras?["itemJson"])).catchError((e) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(AppLocalizations.of(context)!.anErrorHasOccured),
audioServiceHelper
.startInstantMixForItem(
jellyfin_models.BaseItemDto.fromJson(group
.value[actualIndex]
.item
.item
.extras?["itemJson"]))
.catchError((e) {
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(
content: Text(AppLocalizations.of(context)!
.anErrorHasOccured),
));
});
},
),
);

return index == 0 ?
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 16.0, top: 8.0, bottom: 4.0),
child: Text(
"${group.key.hour % 12} ${group.key.hour >= 12 ? "pm" : "am"}",
style: const TextStyle(
fontSize: 16.0,
),
),
),
historyItem,
],
)
: historyItem;

return index == 0
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(
left: 16.0, top: 8.0, bottom: 4.0),
child: Text(
"${group.key.hour % 12} ${group.key.hour >= 12 ? "pm" : "am"}",
style: const TextStyle(
fontSize: 16.0,
),
),
),
historyItem,
],
)
: historyItem;
},
childCount: group.value.length,
),
Expand All @@ -89,9 +98,6 @@ class PlaybackHistoryList extends StatelessWidget {
child: CircularProgressIndicator(),
);
}
}

);
});
}

}
Loading

0 comments on commit 2ef5510

Please sign in to comment.