Skip to content

Commit

Permalink
run dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed May 4, 2024
1 parent eb0dde9 commit 5a33802
Show file tree
Hide file tree
Showing 73 changed files with 1,304 additions and 1,010 deletions.
2 changes: 1 addition & 1 deletion lib/color_schemes.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ const darkColorScheme = ColorScheme(
surfaceTint: Color(0xFF7BD0FF),
outlineVariant: Color(0xFF41484D),
scrim: Color(0xFF000000),
);
);
5 changes: 4 additions & 1 deletion lib/components/AddToPlaylistScreen/add_to_playlist_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ class _AddToPlaylistListState extends State<AddToPlaylistList> {
keepSlow: true));

if (!mounted) return;
GlobalSnackbar.message((scaffold) => AppLocalizations.of(context)!.confirmAddedToPlaylist, isConfirmation: true);
GlobalSnackbar.message(
(scaffold) => AppLocalizations.of(context)!
.confirmAddedToPlaylist,
isConfirmation: true);
Navigator.pop(context);
} catch (e) {
errorSnackbar(e, context);
Expand Down
7 changes: 3 additions & 4 deletions lib/components/AddToPlaylistScreen/new_playlist_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class _NewPlaylistDialogState extends State<NewPlaylistDialog> {
_formKey.currentState!.save();

try {
final newPlaylistResponse = await _jellyfinApiHelper.createNewPlaylist(NewPlaylist(
final newPlaylistResponse =
await _jellyfinApiHelper.createNewPlaylist(NewPlaylist(
name: _name,
ids: [widget.itemToAdd],
userId: _finampUserHelper.currentUser!.id,
Expand All @@ -89,8 +90,7 @@ class _NewPlaylistDialogState extends State<NewPlaylistDialog> {

// resync all playlists, so the new playlist automatically gets downloaded if all playlists should be downloaded

final downloadsService =
GetIt.instance<DownloadsService>();
final downloadsService = GetIt.instance<DownloadsService>();
unawaited(downloadsService.resync(
DownloadStub.fromId(
id: "All Playlists",
Expand All @@ -99,7 +99,6 @@ class _NewPlaylistDialogState extends State<NewPlaylistDialog> {
.finampCollectionNames("allPlaylists")),
null,
keepSlow: true));

} catch (e) {
errorSnackbar(e, context);
setState(() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
AppLocalizations.of(context)!.placeholderSource),
id: parentItem.id,
item: parentItem,
contextNormalizationGain: isPlaylist ? null : parentItem.normalizationGain,
contextNormalizationGain:
isPlaylist ? null : parentItem.normalizationGain,
),
order: FinampPlaybackOrder.linear,
);
Expand All @@ -79,7 +80,8 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
AppLocalizations.of(context)!.placeholderSource),
id: parentItem.id,
item: parentItem,
contextNormalizationGain: isPlaylist ? null : parentItem.normalizationGain,
contextNormalizationGain:
isPlaylist ? null : parentItem.normalizationGain,
),
order: FinampPlaybackOrder.shuffled,
);
Expand All @@ -98,11 +100,14 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
AppLocalizations.of(context)!.placeholderSource),
id: parentItem.id,
item: parentItem,
contextNormalizationGain: isPlaylist ? null : parentItem.normalizationGain,
contextNormalizationGain:
isPlaylist ? null : parentItem.normalizationGain,
),
);
GlobalSnackbar.message((scaffold) => AppLocalizations.of(scaffold)!
.confirmAddToNextUp(isPlaylist ? "playlist" : "album"), isConfirmation: true);
GlobalSnackbar.message(
(scaffold) => AppLocalizations.of(scaffold)!
.confirmAddToNextUp(isPlaylist ? "playlist" : "album"),
isConfirmation: true);
}

void addAlbumNext() {
Expand All @@ -118,10 +123,13 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
AppLocalizations.of(context)!.placeholderSource),
id: parentItem.id,
item: parentItem,
contextNormalizationGain: isPlaylist ? null : parentItem.normalizationGain,
contextNormalizationGain:
isPlaylist ? null : parentItem.normalizationGain,
));
GlobalSnackbar.message((scaffold) => AppLocalizations.of(scaffold)!
.confirmPlayNext(isPlaylist ? "playlist" : "album"), isConfirmation: true);
GlobalSnackbar.message(
(scaffold) => AppLocalizations.of(scaffold)!
.confirmPlayNext(isPlaylist ? "playlist" : "album"),
isConfirmation: true);
}

void shuffleAlbumToNextUp() {
Expand All @@ -140,10 +148,12 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
AppLocalizations.of(context)!.placeholderSource),
id: parentItem.id,
item: parentItem,
contextNormalizationGain: isPlaylist ? null : parentItem.normalizationGain,
contextNormalizationGain:
isPlaylist ? null : parentItem.normalizationGain,
));
GlobalSnackbar.message((scaffold) => AppLocalizations.of(scaffold)!
.confirmShuffleToNextUp, isConfirmation: true);
GlobalSnackbar.message(
(scaffold) => AppLocalizations.of(scaffold)!.confirmShuffleToNextUp,
isConfirmation: true);
}

void shuffleAlbumNext() {
Expand All @@ -162,10 +172,12 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
AppLocalizations.of(context)!.placeholderSource),
id: parentItem.id,
item: parentItem,
contextNormalizationGain: isPlaylist ? null : parentItem.normalizationGain,
contextNormalizationGain:
isPlaylist ? null : parentItem.normalizationGain,
));
GlobalSnackbar.message((scaffold) => AppLocalizations.of(scaffold)!
.confirmShuffleNext, isConfirmation: true);
GlobalSnackbar.message(
(scaffold) => AppLocalizations.of(scaffold)!.confirmShuffleNext,
isConfirmation: true);
}

void addAlbumToQueue() {
Expand All @@ -183,8 +195,10 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
item: parentItem,
),
);
GlobalSnackbar.message((scaffold) => AppLocalizations.of(scaffold)!
.confirmAddToQueue(isPlaylist ? "playlist" : "album"), isConfirmation: true);
GlobalSnackbar.message(
(scaffold) => AppLocalizations.of(scaffold)!
.confirmAddToQueue(isPlaylist ? "playlist" : "album"),
isConfirmation: true);
}

void shuffleAlbumToQueue() {
Expand All @@ -204,8 +218,9 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
id: parentItem.id,
item: parentItem,
));
GlobalSnackbar.message((scaffold) => AppLocalizations.of(scaffold)!
.confirmShuffleToQueue, isConfirmation: true);
GlobalSnackbar.message(
(scaffold) => AppLocalizations.of(scaffold)!.confirmShuffleToQueue,
isConfirmation: true);
}

return FlexibleSpaceBar(
Expand Down Expand Up @@ -252,13 +267,14 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
icon: TablerIcons.player_play,
onPressed: () => playAlbum(),
// set the minimum width as 25% of the screen width,
minWidth: MediaQuery.of(context).size.width * 0.25,
minWidth:
MediaQuery.of(context).size.width * 0.25,
),
PopupMenuButton<AlbumMenuItems>(
enableFeedback: true,
icon: const Icon(TablerIcons.dots_vertical),
onOpened: () =>
FeedbackHelper.feedback(FeedbackType.light),
onOpened: () => FeedbackHelper.feedback(
FeedbackType.light),
itemBuilder: (context) {
final queueService =
GetIt.instance<QueueService>();
Expand All @@ -280,8 +296,8 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
PopupMenuItem<AlbumMenuItems>(
value: AlbumMenuItems.addToNextUp,
child: ListTile(
leading:
const Icon(TablerIcons.corner_right_down_double),
leading: const Icon(TablerIcons
.corner_right_down_double),
title: Text(
AppLocalizations.of(context)!
.addToNextUp),
Expand Down Expand Up @@ -336,13 +352,14 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
icon: TablerIcons.arrows_shuffle,
onPressed: () => shuffleAlbum(),
// set the minimum width as 25% of the screen width,
minWidth: MediaQuery.of(context).size.width * 0.25,
minWidth:
MediaQuery.of(context).size.width * 0.25,
),
PopupMenuButton<AlbumMenuItems>(
enableFeedback: true,
icon: const Icon(TablerIcons.dots_vertical),
onOpened: () =>
FeedbackHelper.feedback(FeedbackType.light),
onOpened: () => FeedbackHelper.feedback(
FeedbackType.light),
itemBuilder: (context) {
final queueService =
GetIt.instance<QueueService>();
Expand All @@ -364,8 +381,8 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
PopupMenuItem<AlbumMenuItems>(
value: AlbumMenuItems.shuffleToNextUp,
child: ListTile(
leading:
const Icon(TablerIcons.corner_right_down_double),
leading: const Icon(TablerIcons
.corner_right_down_double),
title: Text(
AppLocalizations.of(context)!
.shuffleToNextUp),
Expand Down
8 changes: 5 additions & 3 deletions lib/components/AlbumScreen/download_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ class DownloadDialog extends StatefulWidget {
: DownloadProfile(transcodeCodec: FinampTranscodingCodec.original);
profile.downloadLocationId =
FinampSettingsHelper.finampSettings.internalSongDir.id;
GlobalSnackbar.message((scaffold) =>
AppLocalizations.of(scaffold)!.confirmDownloadStarted, isConfirmation: true);
GlobalSnackbar.message(
(scaffold) => AppLocalizations.of(scaffold)!.confirmDownloadStarted,
isConfirmation: true);
unawaited(downloadsService
.addDownload(stub: item, viewId: viewId!, transcodeProfile: profile)
// TODO only show the enqueued confirmation if the enqueuing took longer than ~10 seconds
Expand All @@ -75,7 +76,8 @@ class DownloadDialog extends StatefulWidget {
children = await jellyfinApiHelper.getItems(
parentItem: item.baseItem!,
includeItemTypes: "Audio",
fields: "${jellyfinApiHelper.defaultFields},MediaSources,MediaStreams");
fields:
"${jellyfinApiHelper.defaultFields},MediaSources,MediaStreams");
}
if (!context.mounted) return;
await showDialog(
Expand Down
34 changes: 19 additions & 15 deletions lib/components/AlbumScreen/song_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,15 @@ class _SongListTileState extends ConsumerState<SongListTile>
id: widget.parentItem?.id ?? "",
item: widget.parentItem,
// we're playing from an album, so we should use the album's normalization gain.
contextNormalizationGain: (widget.isInPlaylist ||
widget.isOnArtistScreen)
? null
: widget.parentItem?.normalizationGain,
contextNormalizationGain:
(widget.isInPlaylist || widget.isOnArtistScreen)
? null
: widget.parentItem?.normalizationGain,
),
);
} else {
// TODO put in a real offline songs implementation
if (FinampSettingsHelper.finampSettings.isOffline) {

final settings = FinampSettingsHelper.finampSettings;
final downloadService = GetIt.instance<DownloadsService>();
final finampUserHelper = GetIt.instance<FinampUserHelper>();
Expand All @@ -273,13 +272,17 @@ class _SongListTileState extends ConsumerState<SongListTile>
viewFilter: finampUserHelper.currentUser?.currentView?.id,
nullableViewFilters: settings.showDownloadsWithUnknownLibrary);

var items = offlineItems.map((e) => e.baseItem).whereNotNull().toList();
var items =
offlineItems.map((e) => e.baseItem).whereNotNull().toList();

items = sortItems(items, settings.tabSortBy[TabContentType.songs], settings.tabSortOrder[TabContentType.songs]);
items = sortItems(items, settings.tabSortBy[TabContentType.songs],
settings.tabSortOrder[TabContentType.songs]);

await _queueService.startPlayback(
items: items,
startingIndex: widget.isShownInSearch ? items.indexWhere((element) => element.id == widget.item.id) : await widget.index,
startingIndex: widget.isShownInSearch
? items.indexWhere((element) => element.id == widget.item.id)
: await widget.index,
source: QueueItemSource(
name: QueueItemSourceName(
type: QueueItemSourceNameType.preTranslated,
Expand All @@ -301,7 +304,10 @@ class _SongListTileState extends ConsumerState<SongListTile>
direction: FinampSettingsHelper.finampSettings.disableGesture
? DismissDirection.none
: DismissDirection.horizontal,
dismissThresholds: const {DismissDirection.startToEnd: 0.5, DismissDirection.endToStart: 0.5},
dismissThresholds: const {
DismissDirection.startToEnd: 0.5,
DismissDirection.endToStart: 0.5
},
background: Container(
color: Theme.of(context).colorScheme.secondaryContainer,
alignment: Alignment.centerLeft,
Expand All @@ -312,16 +318,14 @@ class _SongListTileState extends ConsumerState<SongListTile>
children: [
Icon(
TablerIcons.playlist,
color: Theme.of(context)
.colorScheme
.onSecondaryContainer,
color:
Theme.of(context).colorScheme.onSecondaryContainer,
size: 40,
),
Icon(
TablerIcons.playlist,
color: Theme.of(context)
.colorScheme
.onSecondaryContainer,
color:
Theme.of(context).colorScheme.onSecondaryContainer,
size: 40,
)
],
Expand Down
Loading

0 comments on commit 5a33802

Please sign in to comment.