feat: sidebar download count and proper progress color in playbutton

This commit is contained in:
Kingkor Roy Tirtho 2022-12-08 22:09:48 +06:00
parent 1f2d53114d
commit a10bc5b8d8
8 changed files with 53 additions and 44 deletions

View File

@ -94,7 +94,18 @@ class Sidebar extends HookConsumerWidget {
final icon = Icon(e.icon); final icon = Icon(e.icon);
return MapEntry( return MapEntry(
PlatformSidebarItem( 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( title: Text(
e.title, e.title,
style: const TextStyle( style: const TextStyle(

View File

@ -119,32 +119,34 @@ class PlaybuttonCard extends HookWidget {
bottom: 10, bottom: 10,
end: 5, end: 5,
child: Builder(builder: (context) { child: Builder(builder: (context) {
return Container( return PlatformIconButton(
decoration: BoxDecoration( onPressed: onPlaybuttonPressed,
color: iconBgColor, backgroundColor:
shape: BoxShape.circle, PlatformTheme.of(context).primaryColor,
), hoverColor: PlatformTheme.of(context)
child: PlatformIconButton( .primaryColor
onPressed: onPlaybuttonPressed, ?.withOpacity(0.5),
backgroundColor: icon: isLoading
PlatformTheme.of(context).primaryColor, ? SizedBox(
hoverColor: PlatformTheme.of(context) height: 23,
.primaryColor width: 23,
?.withOpacity(0.5), child: PlatformCircularProgressIndicator(
icon: isLoading color:
? const SizedBox( ThemeData.estimateBrightnessForColor(
height: 23, PlatformTheme.of(context)
width: 23, .primaryColor!,
child: ) ==
PlatformCircularProgressIndicator(), Brightness.dark
) ? Colors.white
: Icon( : Colors.grey[900],
isPlaying
? Icons.pause_rounded
: Icons.play_arrow_rounded,
color: Colors.white,
), ),
), )
: Icon(
isPlaying
? Icons.pause_rounded
: Icons.play_arrow_rounded,
color: Colors.white,
),
); );
}), }),
) )

View File

@ -68,21 +68,17 @@ class TrackCollectionView<T> extends HookConsumerWidget {
onPressed: onShare, onPressed: onShare,
), ),
if (heartBtn != null) heartBtn!, if (heartBtn != null) heartBtn!,
const SizedBox(width: 5),
// play playlist // play playlist
Container( PlatformIconButton(
margin: const EdgeInsets.symmetric(vertical: 10), backgroundColor: PlatformTheme.of(context).primaryColor,
child: PlatformFilledButton( onPressed: tracksSnapshot.data != null ? onPlay : null,
style: ButtonStyle( icon: Icon(
shape: MaterialStateProperty.all(const CircleBorder()), isPlaying ? Icons.stop_rounded : Icons.play_arrow_rounded,
), color: PlatformTextTheme.of(context).body?.color,
onPressed: tracksSnapshot.data != null ? onPlay : null,
child: Icon(
isPlaying ? Icons.stop_rounded : Icons.play_arrow_rounded,
color: Theme.of(context).backgroundColor,
),
), ),
), ),
const SizedBox(width: 10),
]; ];
final controller = useScrollController(); final controller = useScrollController();

View File

@ -1,7 +1,7 @@
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:youtube_explode_dart/youtube_explode_dart.dart'; import 'package:youtube_explode_dart/youtube_explode_dart.dart';
part 'CacheTrack.g.dart'; part 'cache_track.g.dart';
@HiveType(typeId: 2) @HiveType(typeId: 2)
class CacheTrackEngagement { class CacheTrackEngagement {

View File

@ -1,6 +1,6 @@
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'CacheTrack.dart'; part of 'cache_track.dart';
// ************************************************************************** // **************************************************************************
// TypeAdapterGenerator // TypeAdapterGenerator

View File

@ -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:spotube/utils/duration.dart';
import 'package:youtube_explode_dart/youtube_explode_dart.dart'; import 'package:youtube_explode_dart/youtube_explode_dart.dart';

View File

@ -12,7 +12,7 @@ import 'package:platform_ui/platform_ui.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:spotube/collections/cache_keys.dart'; import 'package:spotube/collections/cache_keys.dart';
import 'package:spotube/components/shared/dialogs/replace_downloaded_dialog.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/routes.dart';
import 'package:spotube/collections/intents.dart'; import 'package:spotube/collections/intents.dart';
import 'package:spotube/models/logger.dart'; import 'package:spotube/models/logger.dart';
@ -40,7 +40,7 @@ void main() async {
final savedSize = rawSize != null ? json.decode(rawSize) : null; final savedSize = rawSize != null ? json.decode(rawSize) : null;
final double? height = savedSize?["height"]; final double? height = savedSize?["height"];
final double? width = savedSize?["width"]; final double? width = savedSize?["width"];
appWindow.minSize = const Size(900, 700); appWindow.minSize = const Size(1020, 700);
appWindow.alignment = Alignment.center; appWindow.alignment = Alignment.center;
appWindow.title = "Spotube"; appWindow.title = "Spotube";
if (height != null && width != null && height >= 700 && width >= 359) { if (height != null && width != null && height >= 700 && width >= 359) {

View File

@ -7,7 +7,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:spotify/spotify.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/extensions/video.dart';
import 'package:spotube/models/current_playlist.dart'; import 'package:spotube/models/current_playlist.dart';
import 'package:spotube/models/logger.dart'; import 'package:spotube/models/logger.dart';