fix img cache

This commit is contained in:
J. A. Messias 2024-09-13 14:12:18 -03:00
parent 59b4979012
commit 3d71e5ba35
5 changed files with 33 additions and 2 deletions

View File

@ -98,10 +98,13 @@ class _CardItemTemplateComponentWidgetState
} }
Widget _generateImage() { Widget _generateImage() {
CachedNetworkImage.evictFromCache(widget.imagePath ?? '');
return ClipRRect( return ClipRRect(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
child: Image.network( child: CachedNetworkImage(
widget.imagePath ?? '', fadeInDuration: const Duration(milliseconds: 500),
fadeOutDuration: const Duration(milliseconds: 500),
imageUrl: widget.imagePath ?? '',
fit: BoxFit.cover, fit: BoxFit.cover,
width: 90, width: 90,
height: 90, height: 90,

View File

@ -65,6 +65,7 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
context.watch<AppState>(); context.watch<AppState>();
CachedNetworkImage.evictFromCache(widget.imagePath ?? '');
return Container( return Container(
constraints: BoxConstraints( constraints: BoxConstraints(
@ -93,6 +94,7 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
fadeOutDuration: const Duration(milliseconds: 100), fadeOutDuration: const Duration(milliseconds: 100),
imageUrl: widget.imagePath ?? '', imageUrl: widget.imagePath ?? '',
fit: BoxFit.cover, fit: BoxFit.cover,
useOldImageOnUrlChange: true,
), ),
), ),
SizedBox(height: MediaQuery.of(context).size.height * 0.03), SizedBox(height: MediaQuery.of(context).size.height * 0.03),

View File

@ -103,6 +103,7 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
? ValidatorUtil.formatDateTimePicker(widget.pet['birthdayDate']) ? ValidatorUtil.formatDateTimePicker(widget.pet['birthdayDate'])
: '' : ''
: ''); : '');
_model.textFieldFocusData ??= FocusNode(); _model.textFieldFocusData ??= FocusNode();
_model.textControllerObservation ??= TextEditingController( _model.textControllerObservation ??= TextEditingController(

View File

@ -289,6 +289,14 @@ 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:
@ -701,6 +709,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.2.1" version: "6.2.1"
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"
html: html:
dependency: transitive dependency: transitive
description: description:

View File

@ -25,6 +25,7 @@ dependencies:
csv: 6.0.0 csv: 6.0.0
device_info_plus: 10.1.0 device_info_plus: 10.1.0
firebase_messaging: 15.0.1 firebase_messaging: 15.0.1
fast_cached_network_image: ^1.2.9
dropdown_button2: 2.3.9 dropdown_button2: 2.3.9
easy_debounce: 2.0.3 easy_debounce: 2.0.3
equatable: 2.0.5 equatable: 2.0.5