fix: remove FastCachedImage

#1
This commit is contained in:
Matyáš Caras 2024-05-27 21:46:18 +02:00
parent 2461c82e1d
commit a5233a33da
Signed by: hernik
GPG key ID: 2A3175F98820C5C6
9 changed files with 65 additions and 58 deletions

View file

@ -1,4 +1,4 @@
import 'package:fast_cached_network_image/fast_cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:just_audio/just_audio.dart'; import 'package:just_audio/just_audio.dart';
import 'package:just_audio_background/just_audio_background.dart'; import 'package:just_audio_background/just_audio_background.dart';
@ -56,7 +56,7 @@ class AudioPlayerService {
themeNotifier.value = ColorScheme.fromSeed(seedColor: Colors.deepPurple); themeNotifier.value = ColorScheme.fromSeed(seedColor: Colors.deepPurple);
} }
themeNotifier.value = await ColorScheme.fromImageProvider( themeNotifier.value = await ColorScheme.fromImageProvider(
provider: FastCachedImageProvider( provider: CachedNetworkImageProvider(
AudioPlayerService().song!.coverArtUrl, AudioPlayerService().song!.coverArtUrl,
), ),
); );

View file

@ -1,11 +1,9 @@
import 'package:fast_cached_network_image/fast_cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:just_audio_background/just_audio_background.dart'; import 'package:just_audio_background/just_audio_background.dart';
import 'package:just_audio_media_kit/just_audio_media_kit.dart'; import 'package:just_audio_media_kit/just_audio_media_kit.dart';
import 'package:ocarina/api/subsonic/song.dart'; import 'package:ocarina/api/subsonic/song.dart';
import 'package:ocarina/views/home_view.dart'; import 'package:ocarina/views/home_view.dart';
import 'package:ocarina/widgets/player.dart'; import 'package:ocarina/widgets/player.dart';
import 'package:path_provider/path_provider.dart';
import 'package:responsive_sizer/responsive_sizer.dart'; import 'package:responsive_sizer/responsive_sizer.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -19,11 +17,6 @@ void main() async {
androidNotificationOngoing: true, androidNotificationOngoing: true,
); );
await FastCachedImageConfig.init(
clearCacheAfter: const Duration(days: 31),
subDir: (await getApplicationCacheDirectory()).path,
);
sp = await SharedPreferences.getInstance(); sp = await SharedPreferences.getInstance();
runApp(const MyApp()); runApp(const MyApp());
} }

View file

@ -49,6 +49,7 @@ class _AlbumViewState extends State<AlbumView> {
), ),
SizedBox( SizedBox(
height: 65.h, height: 65.h,
width: 95.w,
child: ListView.builder( child: ListView.builder(
itemBuilder: (c, i) => InkWell( itemBuilder: (c, i) => InkWell(
onTap: () async { onTap: () async {

View file

@ -1,4 +1,4 @@
import 'package:fast_cached_network_image/fast_cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:responsive_sizer/responsive_sizer.dart'; import 'package:responsive_sizer/responsive_sizer.dart';
import 'package:shimmer/shimmer.dart'; import 'package:shimmer/shimmer.dart';
@ -27,16 +27,16 @@ class HeroBanner extends StatelessWidget {
width: 180, width: 180,
child: Hero( child: Hero(
tag: heroTag, tag: heroTag,
child: FastCachedImage( child: CachedNetworkImage(
url: imageUrl, imageUrl: imageUrl,
loadingBuilder: (c, d) => Shimmer.fromColors( placeholder: (c, d) => Shimmer.fromColors(
baseColor: Colors.grey.shade300, baseColor: Colors.grey.shade300,
highlightColor: Colors.grey.shade100, highlightColor: Colors.grey.shade100,
child: Container( child: Container(
color: Colors.grey, color: Colors.grey,
), ),
), ),
errorBuilder: (c, _, __) { errorWidget: (c, _, __) {
return ColoredBox( return ColoredBox(
color: Theme.of(context).colorScheme.primaryContainer, color: Theme.of(context).colorScheme.primaryContainer,
child: Center( child: Center(
@ -62,7 +62,7 @@ class HeroBanner extends StatelessWidget {
), ),
Text(description), Text(description),
], ],
) ),
], ],
), ),
); );

View file

@ -1,5 +1,5 @@
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:fast_cached_network_image/fast_cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart'; import 'package:shimmer/shimmer.dart';
import 'package:text_scroll/text_scroll.dart'; import 'package:text_scroll/text_scroll.dart';
@ -27,16 +27,16 @@ class ImageCover extends StatelessWidget {
tag: heroTag, tag: heroTag,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
child: FastCachedImage( child: CachedNetworkImage(
url: imageUrl, imageUrl: imageUrl,
loadingBuilder: (c, d) => Shimmer.fromColors( placeholder: (c, d) => Shimmer.fromColors(
baseColor: Colors.grey.shade300, baseColor: Colors.grey.shade300,
highlightColor: Colors.grey.shade100, highlightColor: Colors.grey.shade100,
child: Container( child: Container(
color: Colors.grey, color: Colors.grey,
), ),
), ),
errorBuilder: (c, _, __) { errorWidget: (c, _, __) {
return ColoredBox( return ColoredBox(
color: Theme.of(context).colorScheme.primaryContainer, color: Theme.of(context).colorScheme.primaryContainer,
child: Center( child: Center(

View file

@ -1,8 +1,8 @@
import 'dart:convert'; import 'dart:convert';
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:crypto/crypto.dart'; import 'package:crypto/crypto.dart';
import 'package:fast_cached_network_image/fast_cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ocarina/api/audio/audioplayer_service.dart'; import 'package:ocarina/api/audio/audioplayer_service.dart';
import 'package:ocarina/api/subsonic/song.dart'; import 'package:ocarina/api/subsonic/song.dart';
@ -100,7 +100,7 @@ class PlayerState extends State<Player> {
), ),
), ),
) )
: FastCachedImage( : CachedNetworkImage(
key: Key( key: Key(
md5 md5
.convert( .convert(
@ -110,8 +110,8 @@ class PlayerState extends State<Player> {
) )
.toString(), .toString(),
), ),
url: t.coverArtUrl, imageUrl: t.coverArtUrl,
loadingBuilder: (c, d) => placeholder: (c, d) =>
Shimmer.fromColors( Shimmer.fromColors(
baseColor: Colors.grey.shade300, baseColor: Colors.grey.shade300,
highlightColor: highlightColor:
@ -120,7 +120,7 @@ class PlayerState extends State<Player> {
color: Colors.grey, color: Colors.grey,
), ),
), ),
errorBuilder: (c, _, __) { errorWidget: (c, _, __) {
logger logger
..e(_) ..e(_)
..e(__); ..e(__);
@ -226,16 +226,17 @@ class PlayerState extends State<Player> {
), ),
), ),
) )
: (FastCachedImage( : (CachedNetworkImage(
url: AudioPlayerService().song!.coverArtUrl, imageUrl:
loadingBuilder: (c, d) => Shimmer.fromColors( AudioPlayerService().song!.coverArtUrl,
placeholder: (c, d) => Shimmer.fromColors(
baseColor: Colors.grey.shade300, baseColor: Colors.grey.shade300,
highlightColor: Colors.grey.shade100, highlightColor: Colors.grey.shade100,
child: Container( child: Container(
color: Colors.grey, color: Colors.grey,
), ),
), ),
errorBuilder: (c, _, __) { errorWidget: (c, _, __) {
logger logger
..e(_) ..e(_)
..e(__); ..e(__);

View file

@ -1,5 +1,5 @@
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:fast_cached_network_image/fast_cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:text_scroll/text_scroll.dart'; import 'package:text_scroll/text_scroll.dart';
@ -13,9 +13,13 @@ class SongRow extends StatelessWidget {
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
child: InkWell( child: InkWell(
child: ListTile( child: ListTile(
leading: ClipRRect( leading: SizedBox(
borderRadius: BorderRadius.circular(8), width: 100,
child: FastCachedImage(url: imageUrl), height: 100,
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: CachedNetworkImage(imageUrl: imageUrl),
),
), ),
title: AutoSizeText( title: AutoSizeText(
songTitle, songTitle,

View file

@ -153,6 +153,30 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "8.9.2" version: "8.9.2"
cached_network_image:
dependency: "direct main"
description:
name: cached_network_image
sha256: "28ea9690a8207179c319965c13cd8df184d5ee721ae2ce60f398ced1219cea1f"
url: "https://pub.dev"
source: hosted
version: "3.3.1"
cached_network_image_platform_interface:
dependency: transitive
description:
name: cached_network_image_platform_interface
sha256: "9e90e78ae72caa874a323d78fa6301b3fb8fa7ea76a8f96dc5b5bf79f283bf2f"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
cached_network_image_web:
dependency: transitive
description:
name: cached_network_image_web
sha256: "205d6a9f1862de34b93184f22b9d2d94586b2f05c581d546695e3d8f6a805cd7"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -249,14 +273,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.1" version: "1.3.1"
fast_cached_network_image:
dependency: "direct main"
description:
name: fast_cached_network_image
sha256: "91f1d48d10e2916b83a1e7545c1eaf752f85b32acfb1473be1f9fa51d73afef0"
url: "https://pub.dev"
source: hosted
version: "1.2.9"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
@ -384,22 +400,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.1.2" version: "5.1.2"
hive:
dependency: transitive
description:
name: hive
sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941"
url: "https://pub.dev"
source: hosted
version: "2.2.3"
hive_flutter:
dependency: transitive
description:
name: hive_flutter
sha256: dca1da446b1d808a51689fb5d0c6c9510c0a2ba01e22805d492c73b68e33eecc
url: "https://pub.dev"
source: hosted
version: "1.1.0"
http: http:
dependency: transitive dependency: transitive
description: description:
@ -608,6 +608,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.5" version: "1.0.5"
octo_image:
dependency: transitive
description:
name: octo_image
sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:

View file

@ -42,7 +42,6 @@ dependencies:
responsive_sizer: ^3.3.1 responsive_sizer: ^3.3.1
path_provider: ^2.1.3 path_provider: ^2.1.3
shimmer: ^3.0.0 shimmer: ^3.0.0
fast_cached_network_image: ^1.2.9
auto_size_text: ^3.0.0 auto_size_text: ^3.0.0
text_scroll: ^0.2.0 text_scroll: ^0.2.0
grouped_list: ^5.1.2 grouped_list: ^5.1.2
@ -55,6 +54,7 @@ dependencies:
json_annotation: ^4.9.0 json_annotation: ^4.9.0
shared_preferences: ^2.2.3 shared_preferences: ^2.2.3
dynamic_color: ^1.7.0 dynamic_color: ^1.7.0
cached_network_image: ^3.3.1
dev_dependencies: dev_dependencies:
build_runner: ^2.4.9 build_runner: ^2.4.9