mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 15:35:17 +00:00
feat: use of smaller sized images
cd: fix versioning of pubspec
This commit is contained in:
parent
4ef7429aa8
commit
0ca97b495f
8
.github/workflows/spotube-nightly.yml
vendored
8
.github/workflows/spotube-nightly.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
||||
|
||||
- run: |
|
||||
curl -sS https://webi.sh/yq | sh
|
||||
yq -i '.version |= sub("\+\d+", "${{ env.GITHUB_RUN_NUMBER }}")' pubspec.yaml
|
||||
yq -i '.version |= sub("\+\d+", "-nightly+${{ env.GITHUB_RUN_NUMBER }}")' pubspec.yaml
|
||||
flutter config --enable-linux-desktop
|
||||
flutter pub get
|
||||
dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}'
|
||||
@ -60,7 +60,7 @@ jobs:
|
||||
|
||||
- run: |
|
||||
curl -sS https://webi.sh/yq | sh
|
||||
yq -i '.version |= sub("\+\d+", "${{ env.GITHUB_RUN_NUMBER }}")' pubspec.yaml
|
||||
yq -i '.version |= sub("\+\d+", "-nightly+${{ env.GITHUB_RUN_NUMBER }}")' pubspec.yaml
|
||||
flutter pub get
|
||||
dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}'
|
||||
echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/upload-keystore.jks
|
||||
@ -88,7 +88,7 @@ jobs:
|
||||
cache: true
|
||||
- run: |
|
||||
choco install sed make yq -y
|
||||
yq -i '.version |= sub("\+\d+", "${{ env.GITHUB_RUN_NUMBER }}")' pubspec.yaml
|
||||
yq -i '.version |= sub("\+\d+", "-nightly+${{ env.GITHUB_RUN_NUMBER }}")' pubspec.yaml
|
||||
sed -i "s/%{{SPOTUBE_VERSION}}%/${{ env.GITHUB_RUN_NUMBER }}/" windows/runner/Runner.rc
|
||||
flutter config --enable-windows-desktop
|
||||
flutter pub get
|
||||
@ -115,7 +115,7 @@ jobs:
|
||||
with:
|
||||
cache: true
|
||||
- run: brew install yq
|
||||
- run: yq -i '.version |= sub("\+\d+", "${{ env.GITHUB_RUN_NUMBER }}")' pubspec.yaml
|
||||
- run: yq -i '.version |= sub("\+\d+", "-nightly+${{ env.GITHUB_RUN_NUMBER }}")' pubspec.yaml
|
||||
- run: flutter config --enable-macos-desktop
|
||||
- run: flutter pub get
|
||||
- run: dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}'
|
||||
|
@ -15,6 +15,7 @@ void main() {
|
||||
throw Exception("In new releases pkgrel should be 1");
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore: avoid_print
|
||||
print("[Failed to parse PKGBUILD] $e");
|
||||
}
|
||||
});
|
||||
|
@ -234,17 +234,10 @@ class ArtistProfile extends HookConsumerWidget {
|
||||
...topTracks.toList().asMap().entries.map((track) {
|
||||
String duration =
|
||||
"${track.value.duration?.inMinutes.remainder(60)}:${PrimitiveUtils.zeroPadNumStr(track.value.duration?.inSeconds.remainder(60) ?? 0)}";
|
||||
String? thumbnailUrl =
|
||||
TypeConversionUtils.image_X_UrlString(
|
||||
track.value.album?.images,
|
||||
index: (track.value.album?.images?.length ?? 1) - 1,
|
||||
placeholder: ImagePlaceholder.albumArt,
|
||||
);
|
||||
return TrackTile(
|
||||
playback,
|
||||
duration: duration,
|
||||
track: track,
|
||||
thumbnailUrl: thumbnailUrl,
|
||||
isActive: playback.track?.id == track.value.id,
|
||||
onTrackPlayButtonPressed: (currentTrack) =>
|
||||
playPlaylist(
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:spotube/components/Shared/UniversalImage.dart';
|
||||
@ -11,7 +12,6 @@ import 'package:spotube/provider/Downloader.dart';
|
||||
import 'package:spotube/provider/SpotifyRequests.dart';
|
||||
import 'package:spotube/provider/UserPreferences.dart';
|
||||
import 'package:spotube/utils/platform.dart';
|
||||
import 'package:spotube/utils/service_utils.dart';
|
||||
import 'package:spotube/utils/type_conversion_utils.dart';
|
||||
|
||||
final sidebarExtendedStateProvider = StateProvider<bool?>((ref) => null);
|
||||
@ -35,7 +35,7 @@ class Sidebar extends HookConsumerWidget {
|
||||
}
|
||||
|
||||
static void goToSettings(BuildContext context) {
|
||||
ServiceUtils.navigate(context, "/settings");
|
||||
GoRouter.of(context).go("/settings");
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:spotify/spotify.dart';
|
||||
@ -32,13 +31,13 @@ class UserDownloads extends HookConsumerWidget {
|
||||
const SizedBox(width: 10),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.red[50],
|
||||
onPrimary: Colors.red[400],
|
||||
backgroundColor: Colors.red[50],
|
||||
foregroundColor: Colors.red[400],
|
||||
),
|
||||
child: const Text("Cancel All"),
|
||||
onPressed: downloader.currentlyRunning > 0
|
||||
? downloader.cancelAll
|
||||
: null,
|
||||
child: const Text("Cancel All"),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -183,9 +183,6 @@ class UserLocalTracks extends HookConsumerWidget {
|
||||
isActive: playback.track?.id == track.id,
|
||||
isChecked: false,
|
||||
showCheck: false,
|
||||
thumbnailUrl: track.album?.images?.isNotEmpty == true
|
||||
? track.album?.images?.single.url
|
||||
: "assets/album-placeholder.png",
|
||||
isLocal: true,
|
||||
onTrackPlayButtonPressed: (currentTrack) {
|
||||
return playLocalTracks(
|
||||
|
@ -1,5 +1,3 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:skeleton_text/skeleton_text.dart';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:spotube/provider/Auth.dart';
|
||||
import 'package:spotube/utils/platform.dart';
|
||||
@ -61,6 +60,7 @@ class WebViewLogin extends HookConsumerWidget {
|
||||
expiration: body.expiration,
|
||||
);
|
||||
if (mounted()) {
|
||||
// ignore: use_build_context_synchronously
|
||||
ServiceUtils.navigate(context, "/");
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import 'package:spotube/components/Shared/TrackTile.dart';
|
||||
import 'package:spotube/hooks/useAutoScrollController.dart';
|
||||
import 'package:spotube/provider/Playback.dart';
|
||||
import 'package:spotube/utils/primitive_utils.dart';
|
||||
import 'package:spotube/utils/type_conversion_utils.dart';
|
||||
|
||||
class PlayerQueue extends HookConsumerWidget {
|
||||
final bool floating;
|
||||
@ -111,10 +110,6 @@ class PlayerQueue extends HookConsumerWidget {
|
||||
playback,
|
||||
track: track,
|
||||
duration: duration,
|
||||
thumbnailUrl: TypeConversionUtils.image_X_UrlString(
|
||||
track.value.album?.images,
|
||||
placeholder: ImagePlaceholder.albumArt,
|
||||
),
|
||||
isActive: playback.track?.id == track.value.id,
|
||||
onTrackPlayButtonPressed: (currentTrack) async {
|
||||
if (playback.track?.id == track.value.id) return;
|
||||
|
@ -44,7 +44,6 @@ class PlayerView extends HookConsumerWidget {
|
||||
String albumArt = useMemoized(
|
||||
() => TypeConversionUtils.image_X_UrlString(
|
||||
currentTrack?.album?.images,
|
||||
index: (currentTrack?.album?.images?.length ?? 1) - 1,
|
||||
placeholder: ImagePlaceholder.albumArt,
|
||||
),
|
||||
[currentTrack?.album?.images],
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:spotify/spotify.dart';
|
||||
import 'package:spotube/components/Shared/PlaybuttonCard.dart';
|
||||
|
@ -114,11 +114,6 @@ class Search extends HookConsumerWidget {
|
||||
playback,
|
||||
track: track,
|
||||
duration: duration,
|
||||
thumbnailUrl:
|
||||
TypeConversionUtils.image_X_UrlString(
|
||||
track.value.album?.images,
|
||||
placeholder: ImagePlaceholder.albumArt,
|
||||
),
|
||||
isActive: playback.track?.id == track.value.id,
|
||||
onTrackPlayButtonPressed: (currentTrack) async {
|
||||
var isPlaylistPlaying = playback.playlist?.id !=
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:spotube/components/Shared/HoverBuilder.dart';
|
||||
import 'package:spotube/components/Shared/SpotubeMarqueeText.dart';
|
||||
@ -58,6 +57,7 @@ class PlaybuttonCard extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: UniversalImage(
|
||||
path: imageUrl,
|
||||
width: 200,
|
||||
placeholder: (context, url) =>
|
||||
Image.asset("assets/placeholder.png"),
|
||||
),
|
||||
@ -69,6 +69,14 @@ class PlaybuttonCard extends StatelessWidget {
|
||||
child: Builder(builder: (context) {
|
||||
return ElevatedButton(
|
||||
onPressed: onPlaybuttonPressed,
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
const CircleBorder(),
|
||||
),
|
||||
padding: MaterialStateProperty.all(
|
||||
const EdgeInsets.all(16),
|
||||
),
|
||||
),
|
||||
child: isLoading
|
||||
? const SizedBox(
|
||||
height: 23,
|
||||
@ -80,14 +88,6 @@ class PlaybuttonCard extends StatelessWidget {
|
||||
? Icons.pause_rounded
|
||||
: Icons.play_arrow_rounded,
|
||||
),
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
const CircleBorder(),
|
||||
),
|
||||
padding: MaterialStateProperty.all(
|
||||
const EdgeInsets.all(16),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
)
|
||||
|
@ -78,11 +78,11 @@ class TrackCollectionView extends HookConsumerWidget {
|
||||
const CircleBorder(),
|
||||
),
|
||||
),
|
||||
onPressed: tracksSnapshot.asData?.value != null ? onPlay : null,
|
||||
child: Icon(
|
||||
isPlaying ? Icons.stop_rounded : Icons.play_arrow_rounded,
|
||||
color: Theme.of(context).backgroundColor,
|
||||
),
|
||||
onPressed: tracksSnapshot.asData?.value != null ? onPlay : null,
|
||||
),
|
||||
),
|
||||
];
|
||||
|
@ -19,7 +19,6 @@ class TrackTile extends HookConsumerWidget {
|
||||
final Playback playback;
|
||||
final MapEntry<int, Track> track;
|
||||
final String duration;
|
||||
final String? thumbnailUrl;
|
||||
final void Function(Track currentTrack)? onTrackPlayButtonPressed;
|
||||
final logger = getLogger(TrackTile);
|
||||
final bool userPlaylist;
|
||||
@ -43,7 +42,6 @@ class TrackTile extends HookConsumerWidget {
|
||||
required this.isActive,
|
||||
this.playlistId,
|
||||
this.userPlaylist = false,
|
||||
this.thumbnailUrl,
|
||||
this.onTrackPlayButtonPressed,
|
||||
this.showAlbum = true,
|
||||
this.isChecked = false,
|
||||
@ -184,6 +182,12 @@ class TrackTile extends HookConsumerWidget {
|
||||
});
|
||||
}
|
||||
|
||||
final String thumbnailUrl = TypeConversionUtils.image_X_UrlString(
|
||||
track.value.album?.images,
|
||||
placeholder: ImagePlaceholder.albumArt,
|
||||
index: track.value.album?.images?.length == 1 ? 0 : 2,
|
||||
);
|
||||
|
||||
return AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 500),
|
||||
decoration: BoxDecoration(
|
||||
@ -209,28 +213,27 @@ class TrackTile extends HookConsumerWidget {
|
||||
child: Text((track.key + 1).toString()),
|
||||
),
|
||||
),
|
||||
if (thumbnailUrl != null)
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: breakpoint.isMoreThan(Breakpoints.md) ? 8.0 : 0,
|
||||
vertical: 8.0,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
||||
child: UniversalImage(
|
||||
path: thumbnailUrl!,
|
||||
height: 40,
|
||||
width: 40,
|
||||
placeholder: (context, url) {
|
||||
return Image.asset(
|
||||
"assets/album-placeholder.png",
|
||||
height: 40,
|
||||
width: 40,
|
||||
);
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: breakpoint.isMoreThan(Breakpoints.md) ? 8.0 : 0,
|
||||
vertical: 8.0,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
||||
child: UniversalImage(
|
||||
path: thumbnailUrl,
|
||||
height: 40,
|
||||
width: 40,
|
||||
placeholder: (context, url) {
|
||||
return Image.asset(
|
||||
"assets/album-placeholder.png",
|
||||
height: 40,
|
||||
width: 40,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
playback.track?.id != null &&
|
||||
|
@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:queue/queue.dart';
|
||||
import 'package:spotify/spotify.dart';
|
||||
import 'package:spotube/components/Shared/DownloadConfirmationDialog.dart';
|
||||
import 'package:spotube/components/Shared/NotFound.dart';
|
||||
@ -10,7 +9,6 @@ import 'package:spotube/hooks/useBreakpoints.dart';
|
||||
import 'package:spotube/provider/Downloader.dart';
|
||||
import 'package:spotube/provider/Playback.dart';
|
||||
import 'package:spotube/utils/primitive_utils.dart';
|
||||
import 'package:spotube/utils/type_conversion_utils.dart';
|
||||
|
||||
class TracksTableView extends HookConsumerWidget {
|
||||
final void Function(Track currentTrack)? onTrackPlayButtonPressed;
|
||||
@ -149,11 +147,6 @@ class TracksTableView extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
...tracks.asMap().entries.map((track) {
|
||||
String? thumbnailUrl = TypeConversionUtils.image_X_UrlString(
|
||||
track.value.album?.images,
|
||||
index: (track.value.album?.images?.length ?? 1) - 1,
|
||||
placeholder: ImagePlaceholder.albumArt,
|
||||
);
|
||||
String duration =
|
||||
"${track.value.duration?.inMinutes.remainder(60)}:${PrimitiveUtils.zeroPadNumStr(track.value.duration?.inSeconds.remainder(60) ?? 0)}";
|
||||
return InkWell(
|
||||
@ -181,7 +174,6 @@ class TracksTableView extends HookConsumerWidget {
|
||||
playlistId: playlistId,
|
||||
track: track,
|
||||
duration: duration,
|
||||
thumbnailUrl: thumbnailUrl,
|
||||
userPlaylist: userPlaylist,
|
||||
isActive: playback.track?.id == track.value.id,
|
||||
onTrackPlayButtonPressed: onTrackPlayButtonPressed,
|
||||
|
@ -21,7 +21,7 @@ enum ImagePlaceholder {
|
||||
abstract class TypeConversionUtils {
|
||||
static String image_X_UrlString(
|
||||
List<Image>? images, {
|
||||
int index = 0,
|
||||
int index = 1,
|
||||
required ImagePlaceholder placeholder,
|
||||
}) {
|
||||
final String placeholderUrl = {
|
||||
@ -31,8 +31,9 @@ abstract class TypeConversionUtils {
|
||||
ImagePlaceholder.online:
|
||||
"https://avatars.dicebear.com/api/bottts/${PrimitiveUtils.uuid.v4()}.png",
|
||||
}[placeholder]!;
|
||||
|
||||
return images != null && images.isNotEmpty
|
||||
? images[0].url!
|
||||
? images[index > images.length - 1 ? images.length - 1 : index].url!
|
||||
: placeholderUrl;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user