Skip to content

Commit

Permalink
fix color not caching
Browse files Browse the repository at this point in the history
  • Loading branch information
shaan-mephobic committed Nov 5, 2021
1 parent 9f91ee2 commit 9260379
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions lib/src/beginning/utilities/audio_handlers/artwork.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ playerontap() async {
}
if (musicBox.get("colorsDB") == null
? true
: musicBox.get("colorsDB")[artworksData[
(musicBox.get("artworksPointer") ??
{})[nowMediaItem.extras!['id']]]] ==
: musicBox.get("colorsDB")[(musicBox.get("artworksPointer") ??
{})[nowMediaItem.extras!['id']]] ==
null) {
if (artwork == defaultNone) {
if (musicBox.get("dominantDefault") != null) {
Expand All @@ -71,24 +70,23 @@ playerontap() async {
} else {
await getImagePalette(MemoryImage(artwork!));
Map colorDB = musicBox.get("colorsDB") ?? {};
colorDB[artworksData[(musicBox.get("artworksPointer") ??
{})[nowMediaItem.extras!['id']]]] = [
colorDB[(musicBox.get("artworksPointer") ??
{})[nowMediaItem.extras!['id']]] = [
nowColor.value,
nowContrast.value,
isArtworkDark
];
musicBox.put("colorsDB", colorDB);
}
} else {
nowColor = Color(musicBox.get("colorsDB")[artworksData[
(musicBox.get("artworksPointer") ??
{})[nowMediaItem.extras!['id']]]][0]);
nowContrast = Color(musicBox.get("colorsDB")[artworksData[
(musicBox.get("artworksPointer") ??
{})[nowMediaItem.extras!['id']]]][1]);
isArtworkDark = musicBox.get("colorsDB")[artworksData[
(musicBox.get("artworksPointer") ??
{})[nowMediaItem.extras!['id']]]][2];
nowColor = Color(musicBox.get("colorsDB")[
(musicBox.get("artworksPointer") ?? {})[nowMediaItem.extras!['id']]]
[0]);
nowContrast = Color(musicBox.get("colorsDB")[
(musicBox.get("artworksPointer") ?? {})[nowMediaItem.extras!['id']]]
[1]);
isArtworkDark = musicBox.get("colorsDB")[
(musicBox.get("artworksPointer") ?? {})[nowMediaItem.extras!['id']]][2];
}

if (!isPlayerShown) {
Expand Down

0 comments on commit 9260379

Please sign in to comment.