Skip to content

Commit

Permalink
run dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed Sep 24, 2024
1 parent 6ecdb9d commit d1845a3
Show file tree
Hide file tree
Showing 37 changed files with 974 additions and 684 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ class _AddToPlaylistButtonState extends ConsumerState<AddToPlaylistButton> {
return GlobalSnackbar.message((context) =>
AppLocalizations.of(context)!.notAvailableInOfflineMode);
}

bool inPlaylist = queueItemInPlaylist(widget.queueItem);
await showPlaylistActionsMenu(
context: context,
item: widget.item!,
parentPlaylist: inPlaylist ? widget.queueItem!.source.item : null,
parentPlaylist:
inPlaylist ? widget.queueItem!.source.item : null,
usePlayerTheme: true,
);
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,4 +437,4 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
),
);
}
}
}
2 changes: 1 addition & 1 deletion lib/components/AlbumScreen/download_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,4 @@ class _DownloadDialogState extends State<DownloadDialog> {
],
);
}
}
}
16 changes: 8 additions & 8 deletions lib/components/AlbumScreen/song_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,12 @@ class _SongListTileState extends ConsumerState<SongListTile>
List<DownloadStub> offlineItems;
// If we're on the songs tab, just get all of the downloaded items
offlineItems = await downloadsService.getAllSongs(
// nameFilter: widget.searchTerm,
viewFilter: finampUserHelper.currentUser?.currentView?.id,
nullableViewFilters:
settings.showDownloadsWithUnknownLibrary,
onlyFavorites:
settings.onlyShowFavourite && settings.trackOfflineFavorites,
// nameFilter: widget.searchTerm,
viewFilter: finampUserHelper.currentUser?.currentView?.id,
nullableViewFilters:
settings.showDownloadsWithUnknownLibrary,
onlyFavorites: settings.onlyShowFavourite &&
settings.trackOfflineFavorites,
);

var items = offlineItems
Expand All @@ -308,8 +308,8 @@ class _SongListTileState extends ConsumerState<SongListTile>
source: QueueItemSource(
name: QueueItemSourceName(
type: widget.item.name != null
? QueueItemSourceNameType.mix
: QueueItemSourceNameType.instantMix,
? QueueItemSourceNameType.mix
: QueueItemSourceNameType.instantMix,
localizationParameter: widget.item.name ?? "",
),
type: QueueItemSourceType.allSongs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class KeepScreenOnWhilePluggedInSelector extends StatelessWidget {
builder: (_, box, __) {
return SwitchListTile.adaptive(
title: Text(AppLocalizations.of(context)!.keepScreenOnWhilePluggedIn),
subtitle: Text(AppLocalizations.of(context)!.keepScreenOnWhilePluggedInSubtitle),
subtitle: Text(
AppLocalizations.of(context)!.keepScreenOnWhilePluggedInSubtitle),
value: FinampSettingsHelper.finampSettings.keepScreenOnWhilePluggedIn,
onChanged: (value) {
FinampSettingsHelper.setKeepScreenOnWhileCharging(value);
Expand Down
3 changes: 2 additions & 1 deletion lib/components/MusicScreen/alphabet_item_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class _AlphabetListState extends State<AlphabetList> {
onPointerUp: (x) => updateSelected(x.localPosition, Drag.end),
behavior: HitTestBehavior.opaque,
child: Semantics(
excludeSemantics: true, // replace child semantics with custom semantics
excludeSemantics:
true, // replace child semantics with custom semantics
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(
Expand Down
4 changes: 2 additions & 2 deletions lib/components/PlayerScreen/album_chip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class _AlbumChipContent extends StatelessWidget {
(album) => Navigator.of(context).pushNamed(
AlbumScreen.routeName,
arguments: album!.baseItem!))
: () => jellyfinApiHelper.getItemById(item.albumId!).then((album) =>
Navigator.of(context)
: () => jellyfinApiHelper.getItemById(item.albumId!).then(
(album) => Navigator.of(context)
.pushNamed(AlbumScreen.routeName, arguments: album)),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 4),
Expand Down
3 changes: 2 additions & 1 deletion lib/components/PlayerScreen/artist_chip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ class ArtistChip extends ConsumerWidget {
final BaseItemDto? localArtist;
if (artist != null &&
FinampSettingsHelper.finampSettings.showArtistChipImage) {
localArtist = ref.watch(artistItemProvider(artist!.id)).valueOrNull ?? artist;
localArtist =
ref.watch(artistItemProvider(artist!.id)).valueOrNull ?? artist;
} else {
localArtist = artist;
}
Expand Down
9 changes: 6 additions & 3 deletions lib/components/PlayerScreen/player_buttons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class PlayerButtons extends StatelessWidget {
PlayerButtonsRepeating(),
Semantics.fromProperties(
properties: SemanticsProperties(
label: AppLocalizations.of(context)!.skipToPreviousTrackButtonTooltip,
label: AppLocalizations.of(context)!
.skipToPreviousTrackButtonTooltip,
button: true,
),
container: true,
Expand All @@ -53,7 +54,8 @@ class PlayerButtons extends StatelessWidget {
),
Semantics.fromProperties(
properties: SemanticsProperties(
label: AppLocalizations.of(context)!.togglePlaybackButtonTooltip,
label:
AppLocalizations.of(context)!.togglePlaybackButtonTooltip,
button: true,
),
container: true,
Expand Down Expand Up @@ -88,7 +90,8 @@ class PlayerButtons extends StatelessWidget {
),
Semantics.fromProperties(
properties: SemanticsProperties(
label: AppLocalizations.of(context)!.skipToNextTrackButtonTooltip,
label: AppLocalizations.of(context)!
.skipToNextTrackButtonTooltip,
button: true,
),
container: true,
Expand Down
3 changes: 2 additions & 1 deletion lib/components/PlayerScreen/player_buttons_repeating.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class PlayerButtonsRepeating extends StatelessWidget {
stream: mediaStateStream,
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
return IconButton(
tooltip: "${getLocalizedLoopMode(context, queueService.loopMode)}. ${AppLocalizations.of(context)!.genericToggleButtonTooltip}",
tooltip:
"${getLocalizedLoopMode(context, queueService.loopMode)}. ${AppLocalizations.of(context)!.genericToggleButtonTooltip}",
onPressed: () async {
FeedbackHelper.feedback(FeedbackType.light);
queueService.toggleLoopMode();
Expand Down
7 changes: 4 additions & 3 deletions lib/components/PlayerScreen/player_buttons_shuffle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class PlayerButtonsShuffle extends StatelessWidget {
stream: mediaStateStream,
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
return IconButton(
tooltip: getLocalizedPlaybackOrder(context, _queueService.playbackOrder),
tooltip:
getLocalizedPlaybackOrder(context, _queueService.playbackOrder),
onPressed: () async {
FeedbackHelper.feedback(FeedbackType.light);
_queueService.togglePlaybackOrder();
Expand All @@ -38,13 +39,13 @@ class PlayerButtonsShuffle extends StatelessWidget {
);
}

String getLocalizedPlaybackOrder(BuildContext context, FinampPlaybackOrder playbackOrder) {
String getLocalizedPlaybackOrder(
BuildContext context, FinampPlaybackOrder playbackOrder) {
switch (playbackOrder) {
case FinampPlaybackOrder.linear:
return AppLocalizations.of(context)!.playbackOrderLinearButtonTooltip;
case FinampPlaybackOrder.shuffled:
return AppLocalizations.of(context)!.playbackOrderShuffledButtonTooltip;
}
}

}
10 changes: 7 additions & 3 deletions lib/components/PlayerScreen/player_screen_album_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ class PlayerScreenAlbumImage extends ConsumerWidget {
final currentTrack = snapshot.data!.currentTrack;

return Semantics(
label: AppLocalizations.of(context)!.playerAlbumArtworkTooltip(currentTrack?.item.title ?? AppLocalizations.of(context)!.unknownName),
excludeSemantics: true, // replace child semantics with custom semantics
label: AppLocalizations.of(context)!.playerAlbumArtworkTooltip(
currentTrack?.item.title ??
AppLocalizations.of(context)!.unknownName),
excludeSemantics:
true, // replace child semantics with custom semantics
container: true,
child: GestureDetector(
onSecondaryTapDown: (_) async {
Expand All @@ -58,7 +61,8 @@ class PlayerScreenAlbumImage extends ConsumerWidget {
child: SimpleGestureDetector(
//TODO replace with PageView, this is just a placeholder
onTap: () {
final audioService = GetIt.instance<MusicPlayerBackgroundTask>();
final audioService =
GetIt.instance<MusicPlayerBackgroundTask>();
audioService.togglePlayback();
FeedbackHelper.feedback(FeedbackType.selection);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ Widget buildPlayerSplitScreenScaffold(BuildContext context, Widget? widget) {
arguments: x.arguments);
return EmptyRoute();
},
observers: [KeepScreenOnObserver()]
),
observers: [KeepScreenOnObserver()]),
)),
)
]);
Expand Down
39 changes: 24 additions & 15 deletions lib/components/PlayerScreen/progress_slider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ class _ProgressSliderDuration extends StatelessWidget {
@override
Widget build(BuildContext context) {
final showRemaining = Platform.isIOS || Platform.isMacOS;
final currentPosition = Duration(seconds: (position.inMilliseconds / 1000).round());
final roundedDuration = Duration(seconds: ((itemDuration?.inMilliseconds ?? 0) / 1000).round());
final currentPosition =
Duration(seconds: (position.inMilliseconds / 1000).round());
final roundedDuration =
Duration(seconds: ((itemDuration?.inMilliseconds ?? 0) / 1000).round());
return Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Expand All @@ -151,10 +153,9 @@ class _ProgressSliderDuration extends StatelessWidget {
Text(
printDuration(
// display remaining time if on iOS or macOS
showRemaining ?
(roundedDuration - currentPosition)
: roundedDuration
,
showRemaining
? (roundedDuration - currentPosition)
: roundedDuration,
isRemaining: showRemaining,
),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
Expand Down Expand Up @@ -230,15 +231,23 @@ class __PlaybackProgressSliderState
.clamp(0, widget.mediaItem!.duration!.inMicroseconds.toDouble())
.toDouble(),
semanticFormatterCallback: (double value) {
final positionFullMinutes = Duration(microseconds: value.toInt()).inMinutes % 60;
final positionFullHours = Duration(microseconds: value.toInt()).inHours;
final positionSeconds = Duration(microseconds: value.toInt()).inSeconds % 60;
final positionFullMinutes =
Duration(microseconds: value.toInt()).inMinutes % 60;
final positionFullHours =
Duration(microseconds: value.toInt()).inHours;
final positionSeconds =
Duration(microseconds: value.toInt()).inSeconds % 60;
final durationFullHours = (widget.mediaItem?.duration?.inHours ?? 0);
final durationFullMinutes = (widget.mediaItem?.duration?.inMinutes ?? 0) % 60;
final durationSeconds = (widget.mediaItem?.duration?.inSeconds ?? 0) % 60;
final positionString = "${positionFullHours > 0 ? "$positionFullHours ${AppLocalizations.of(context)!.hours} " : ""}${positionFullMinutes > 0 ? "$positionFullMinutes ${AppLocalizations.of(context)!.minutes} " : ""}$positionSeconds ${AppLocalizations.of(context)!.seconds}";
final durationString = "${durationFullHours > 0 ? "$durationFullHours ${AppLocalizations.of(context)!.hours} " : ""}${durationFullMinutes > 0 ? "$durationFullMinutes ${AppLocalizations.of(context)!.minutes} " : ""}$durationSeconds ${AppLocalizations.of(context)!.seconds}";
return AppLocalizations.of(context)!.timeFractionTooltip(positionString, durationString);
final durationFullMinutes =
(widget.mediaItem?.duration?.inMinutes ?? 0) % 60;
final durationSeconds =
(widget.mediaItem?.duration?.inSeconds ?? 0) % 60;
final positionString =
"${positionFullHours > 0 ? "$positionFullHours ${AppLocalizations.of(context)!.hours} " : ""}${positionFullMinutes > 0 ? "$positionFullMinutes ${AppLocalizations.of(context)!.minutes} " : ""}$positionSeconds ${AppLocalizations.of(context)!.seconds}";
final durationString =
"${durationFullHours > 0 ? "$durationFullHours ${AppLocalizations.of(context)!.hours} " : ""}${durationFullMinutes > 0 ? "$durationFullMinutes ${AppLocalizations.of(context)!.minutes} " : ""}$durationSeconds ${AppLocalizations.of(context)!.seconds}";
return AppLocalizations.of(context)!
.timeFractionTooltip(positionString, durationString);
},
secondaryTrackValue:
widget.mediaItem?.extras?["downloadedSongPath"] == null
Expand Down Expand Up @@ -274,7 +283,7 @@ class __PlaybackProgressSliderState
// Seek to the new position
await _audioHandler
.seek(Duration(microseconds: newValue.toInt()));

// Clear drag value so that the slider uses the play
// duration again.
if (mounted) {
Expand Down
10 changes: 5 additions & 5 deletions lib/components/PlayerScreen/queue_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class QueueButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SimpleButton(
text: AppLocalizations.of(context)!.queue,
icon: TablerIcons.playlist,
onPressed: () {
showQueueBottomSheet(context);
});
text: AppLocalizations.of(context)!.queue,
icon: TablerIcons.playlist,
onPressed: () {
showQueueBottomSheet(context);
});
}
}
3 changes: 2 additions & 1 deletion lib/components/PlayerScreen/queue_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,8 @@ class _CurrentTrackState extends State<CurrentTrack> {
width: (screenSize.width -
2 * horizontalPadding -
albumImageSize) *
((playbackPosition?.inMilliseconds ?? 0) /
((playbackPosition?.inMilliseconds ??
0) /
(mediaState?.mediaItem
?.duration ??
const Duration(
Expand Down
5 changes: 2 additions & 3 deletions lib/components/PlayerScreen/queue_source_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ Future<bool> removeFromPlaylist(BuildContext context, BaseItemDto item,
// re-sync playlist to delete removed item if not required anymore
final downloadsService = GetIt.instance<DownloadsService>();
unawaited(downloadsService.resync(
DownloadStub.fromItem(type: DownloadItemType.collection, item: parent),
DownloadStub.fromItem(
type: DownloadItemType.collection, item: parent),
null,
keepSlow: true));

Expand All @@ -112,9 +113,7 @@ Future<bool> removeFromPlaylist(BuildContext context, BaseItemDto item,
(context) => AppLocalizations.of(context)!.removedFromPlaylist,
isConfirmation: true);
return true;

} catch (err) {

GlobalSnackbar.error(err);
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/components/PlayerScreen/song_name_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class SongNameContent extends StatelessWidget {
),
child: Semantics.fromProperties(
properties: SemanticsProperties(
label: "${currentTrack.item.title} (${AppLocalizations.of(context)!.title})",
label:
"${currentTrack.item.title} (${AppLocalizations.of(context)!.title})",
),
excludeSemantics: true,
container: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class _VolumeNormalizationIOSBaseGainEditorState
child: TextField(
controller: _controller,
textAlign: TextAlign.center,
keyboardType: const TextInputType.numberWithOptions(decimal: true, signed: true),
keyboardType: const TextInputType.numberWithOptions(
decimal: true, signed: true),
onChanged: (value) {
final valueDouble = double.tryParse(value);

Expand Down
14 changes: 9 additions & 5 deletions lib/components/album_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,17 @@ class AlbumImage extends ConsumerWidget {
// Because of this, we convert the logical pixels to physical pixels by multiplying by the device's DPI.
final MediaQueryData mediaQuery = MediaQuery.of(context);
physicalWidth =
(constraints.maxWidth * mediaQuery.devicePixelRatio).toInt();
(constraints.maxWidth * mediaQuery.devicePixelRatio)
.toInt();
physicalHeight =
(constraints.maxHeight * mediaQuery.devicePixelRatio).toInt();
(constraints.maxHeight * mediaQuery.devicePixelRatio)
.toInt();
// If using grid music screen view without fixed size tiles, and if the view is resizable due
// to being on desktop and using split screen, then clamp album size to reduce server requests when resizing.
if ((!(Platform.isIOS || Platform.isAndroid) ||
usingPlayerSplitScreen) &&
!FinampSettingsHelper.finampSettings.useFixedSizeGridTiles &&
!FinampSettingsHelper
.finampSettings.useFixedSizeGridTiles &&
FinampSettingsHelper.finampSettings.contentViewType ==
ContentViewType.grid) {
physicalWidth =
Expand All @@ -110,7 +113,7 @@ class AlbumImage extends ConsumerWidget {
exp((log(physicalHeight) * 3).ceil() / 3).toInt();
}
}

var image = Container(
decoration: decoration,
child: BareAlbumImage(
Expand All @@ -123,7 +126,8 @@ class AlbumImage extends ConsumerWidget {
imageProviderCallback: themeCallback == null
? null
: (image) => themeCallback!(
FinampTheme.fromImageDeferred(image, item?.blurHash)),
FinampTheme.fromImageDeferred(
image, item?.blurHash)),
placeholderBuilder: placeholderBuilder),
);
return disabled
Expand Down
Loading

0 comments on commit d1845a3

Please sign in to comment.