Skip to content

Commit

Permalink
feat: sidebar download count and proper progress color in playbutton
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Dec 8, 2022
1 parent 1f2d531 commit a10bc5b
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 44 deletions.
13 changes: 12 additions & 1 deletion lib/components/root/sidebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,18 @@ class Sidebar extends HookConsumerWidget {
final icon = Icon(e.icon);
return MapEntry(
PlatformSidebarItem(
icon: icon,
icon: Badge(
badgeColor: PlatformTheme.of(context).primaryColor!,
showBadge: e.title == "Library" && downloadCount > 0,
badgeContent: Text(
downloadCount.toString(),
style: const TextStyle(
color: Colors.white,
fontSize: 10,
),
),
child: icon,
),
title: Text(
e.title,
style: const TextStyle(
Expand Down
52 changes: 27 additions & 25 deletions lib/components/shared/playbutton_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,32 +119,34 @@ class PlaybuttonCard extends HookWidget {
bottom: 10,
end: 5,
child: Builder(builder: (context) {
return Container(
decoration: BoxDecoration(
color: iconBgColor,
shape: BoxShape.circle,
),
child: PlatformIconButton(
onPressed: onPlaybuttonPressed,
backgroundColor:
PlatformTheme.of(context).primaryColor,
hoverColor: PlatformTheme.of(context)
.primaryColor
?.withOpacity(0.5),
icon: isLoading
? const SizedBox(
height: 23,
width: 23,
child:
PlatformCircularProgressIndicator(),
)
: Icon(
isPlaying
? Icons.pause_rounded
: Icons.play_arrow_rounded,
color: Colors.white,
return PlatformIconButton(
onPressed: onPlaybuttonPressed,
backgroundColor:
PlatformTheme.of(context).primaryColor,
hoverColor: PlatformTheme.of(context)
.primaryColor
?.withOpacity(0.5),
icon: isLoading
? SizedBox(
height: 23,
width: 23,
child: PlatformCircularProgressIndicator(
color:
ThemeData.estimateBrightnessForColor(
PlatformTheme.of(context)
.primaryColor!,
) ==
Brightness.dark
? Colors.white
: Colors.grey[900],
),
),
)
: Icon(
isPlaying
? Icons.pause_rounded
: Icons.play_arrow_rounded,
color: Colors.white,
),
);
}),
)
Expand Down
20 changes: 8 additions & 12 deletions lib/components/shared/track_table/track_collection_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,17 @@ class TrackCollectionView<T> extends HookConsumerWidget {
onPressed: onShare,
),
if (heartBtn != null) heartBtn!,

const SizedBox(width: 5),
// play playlist
Container(
margin: const EdgeInsets.symmetric(vertical: 10),
child: PlatformFilledButton(
style: ButtonStyle(
shape: MaterialStateProperty.all(const CircleBorder()),
),
onPressed: tracksSnapshot.data != null ? onPlay : null,
child: Icon(
isPlaying ? Icons.stop_rounded : Icons.play_arrow_rounded,
color: Theme.of(context).backgroundColor,
),
PlatformIconButton(
backgroundColor: PlatformTheme.of(context).primaryColor,
onPressed: tracksSnapshot.data != null ? onPlay : null,
icon: Icon(
isPlaying ? Icons.stop_rounded : Icons.play_arrow_rounded,
color: PlatformTextTheme.of(context).body?.color,
),
),
const SizedBox(width: 10),
];

final controller = useScrollController();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:hive/hive.dart';
import 'package:youtube_explode_dart/youtube_explode_dart.dart';

part 'CacheTrack.g.dart';
part 'cache_track.g.dart';

@HiveType(typeId: 2)
class CacheTrackEngagement {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/extensions/video.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:spotube/entities/CacheTrack.dart';
import 'package:spotube/entities/cache_track.dart';
import 'package:spotube/utils/duration.dart';
import 'package:youtube_explode_dart/youtube_explode_dart.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:platform_ui/platform_ui.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:spotube/collections/cache_keys.dart';
import 'package:spotube/components/shared/dialogs/replace_downloaded_dialog.dart';
import 'package:spotube/entities/CacheTrack.dart';
import 'package:spotube/entities/cache_track.dart';
import 'package:spotube/collections/routes.dart';
import 'package:spotube/collections/intents.dart';
import 'package:spotube/models/logger.dart';
Expand Down Expand Up @@ -40,7 +40,7 @@ void main() async {
final savedSize = rawSize != null ? json.decode(rawSize) : null;
final double? height = savedSize?["height"];
final double? width = savedSize?["width"];
appWindow.minSize = const Size(900, 700);
appWindow.minSize = const Size(1020, 700);
appWindow.alignment = Alignment.center;
appWindow.title = "Spotube";
if (height != null && width != null && height >= 700 && width >= 359) {
Expand Down
2 changes: 1 addition & 1 deletion lib/provider/playback_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hive/hive.dart';
import 'package:spotify/spotify.dart';
import 'package:spotube/entities/CacheTrack.dart';
import 'package:spotube/entities/cache_track.dart';
import 'package:spotube/extensions/video.dart';
import 'package:spotube/models/current_playlist.dart';
import 'package:spotube/models/logger.dart';
Expand Down

0 comments on commit a10bc5b

Please sign in to comment.