Skip to content

CacheManagerΒ #61

@simplenotezy

Description

@simplenotezy

Is there a way to control CacheManager?

Today we have added Blurhash like below, but I noticed we could also add in the actual url to blurhash as a parameter, and thus perhaps we could eliminate a lot of our own code (and hopefully piggyback-ride onto an smoother transition from blur to image).

CachedNetworkImage(
  imageUrl: url,
  fadeInCurve: Curves.linear,
  fadeOutCurve: Curves.linear,
  fit: BoxFit.cover,
  width: width,
  height: height,
  fadeInDuration: Duration(milliseconds: 250),
  fadeOutDuration: Duration(milliseconds: 250),
  cacheManager: CacheManager(
    Config(
      url,
      maxNrOfCacheObjects: 500,
      stalePeriod: stalePeriod ?? const Duration(days: 30),
    ),
  ),
  placeholder: Stack(
    fit: StackFit.expand,
    children: [
      BlurHash(
        hash: image.blurhash,
        imageFit: BoxFit.cover,
      ),
      Center(
        child: LoadingSpinner(
          radius: spinnerRadius ?? 15,
          strokeWidth: spinnerStrokeWidth ?? 1,
        ),
      ),
    ],
  ),
  errorWidget: (context, _, __) => ProfilePlaceholder(width: width, height: height),
)

However, it would be ideal for us to control errorWidget as well as the cacheManager.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions