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:just_audio/just_audio.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 = await ColorScheme.fromImageProvider(
provider: FastCachedImageProvider(
provider: CachedNetworkImageProvider(
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:just_audio_background/just_audio_background.dart';
import 'package:just_audio_media_kit/just_audio_media_kit.dart';
import 'package:ocarina/api/subsonic/song.dart';
import 'package:ocarina/views/home_view.dart';
import 'package:ocarina/widgets/player.dart';
import 'package:path_provider/path_provider.dart';
import 'package:responsive_sizer/responsive_sizer.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -19,11 +17,6 @@ void main() async {
androidNotificationOngoing: true,
);
await FastCachedImageConfig.init(
clearCacheAfter: const Duration(days: 31),
subDir: (await getApplicationCacheDirectory()).path,
);
sp = await SharedPreferences.getInstance();
runApp(const MyApp());
}

View file

@ -49,6 +49,7 @@ class _AlbumViewState extends State<AlbumView> {
),
SizedBox(
height: 65.h,
width: 95.w,
child: ListView.builder(
itemBuilder: (c, i) => InkWell(
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:responsive_sizer/responsive_sizer.dart';
import 'package:shimmer/shimmer.dart';
@ -27,16 +27,16 @@ class HeroBanner extends StatelessWidget {
width: 180,
child: Hero(
tag: heroTag,
child: FastCachedImage(
url: imageUrl,
loadingBuilder: (c, d) => Shimmer.fromColors(
child: CachedNetworkImage(
imageUrl: imageUrl,
placeholder: (c, d) => Shimmer.fromColors(
baseColor: Colors.grey.shade300,
highlightColor: Colors.grey.shade100,
child: Container(
color: Colors.grey,
),
),
errorBuilder: (c, _, __) {
errorWidget: (c, _, __) {
return ColoredBox(
color: Theme.of(context).colorScheme.primaryContainer,
child: Center(
@ -62,7 +62,7 @@ class HeroBanner extends StatelessWidget {
),
Text(description),
],
)
),
],
),
);

View file

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

View file

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

View file

@ -1,5 +1,5 @@
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:text_scroll/text_scroll.dart';
@ -13,9 +13,13 @@ class SongRow extends StatelessWidget {
borderRadius: BorderRadius.circular(8),
child: InkWell(
child: ListTile(
leading: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: FastCachedImage(url: imageUrl),
leading: SizedBox(
width: 100,
height: 100,
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: CachedNetworkImage(imageUrl: imageUrl),
),
),
title: AutoSizeText(
songTitle,

View file

@ -153,6 +153,30 @@ packages:
url: "https://pub.dev"
source: hosted
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:
dependency: transitive
description:
@ -249,14 +273,6 @@ packages:
url: "https://pub.dev"
source: hosted
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:
dependency: transitive
description:
@ -384,22 +400,6 @@ packages:
url: "https://pub.dev"
source: hosted
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:
dependency: transitive
description:
@ -608,6 +608,14 @@ packages:
url: "https://pub.dev"
source: hosted
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:
dependency: transitive
description:

View file

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