Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CacheManager #61

Open
simplenotezy opened this issue Sep 22, 2023 · 0 comments
Open

CacheManager #61

simplenotezy opened this issue Sep 22, 2023 · 0 comments

Comments

@simplenotezy
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant