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

Cached memory image #862

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cached_network_image/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
compileSdkVersion 34

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -39,8 +39,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion 16
targetSdkVersion 31
minSdkVersion 19
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
ndkVersion = "21.1.6352462"
Expand Down
10 changes: 5 additions & 5 deletions cached_network_image/example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
buildscript {
ext.kotlin_version = '1.6.21'
ext.kotlin_version = '1.7.20'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
7 changes: 7 additions & 0 deletions cached_network_image/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:convert';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:baseflow_plugin_template/baseflow_plugin_template.dart';
Expand Down Expand Up @@ -117,6 +118,9 @@ class BasicContent extends StatelessWidget {
fadeInDuration: const Duration(seconds: 3),
),
),
_sizedContainer(
Image(image:CachedMemoryImageProvider(byteImage,base64Decode(byteImage)))
),
],
),
),
Expand Down Expand Up @@ -208,3 +212,6 @@ class GridContent extends StatelessWidget {
return const Center(child: Icon(Icons.error));
}
}


const byteImage = "iVBORw0KGgoAAAANSUhEUgAAAJYAAACDCAYAAABvGuLKAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAB8SSURBVHgB7Z19cBv1mcef1ZsVv8QyTlLHIWQNJKEludgFCuHlWB8t0A4Fp7wW6MW+lunA9RpnpjOFXmfiTEuhMzeN+aN3c3BtlL5wbWlrQ+AoBWrleAkpL1EuB5QE6nUCTkgIlt/iF0m79zyrXVkvu6vd1e5K9ukzs5a0v92VrP3qeZ7f83sDqKDK4OAga2RfBXV8MM8YGRkJ4UMrbqy8K4ZbtKGhgYcKZcO8ERYKqoNhmC2QElUot3x0dLSnvr5+O1QoC0oqLBQLhw+tHo9nAz7GBEHYg5anP+eYThTUNpizUKqIotiDxzJ4fg9UKDkMuAy5MhTSFhRCN6hYHhSRZHlIdLKgODBODK/bguKKQZFQPNXS0sKLEArNQoBjQLySPu84ut1GOPkQVNDFVWHJYtkJBawPHtMrC880eN6mXKtn+FwU0TT4WkWyoksar2Q+GkG3K7JKeRyPeBb/ToHYezuMbYUKmrjmCjEG2mFULFZFJRMy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/Stjad2ejOCerqftPC4LFJeESVZXCwbokfaRwIsZCF9ZHnw4h148Aaa0Zg+CF4klPsrqgjEHYaPH4dHf/N76fGdd99FYX2oedz4xATU1dYWvNYTTz8jHZvLa9EDcMctN2qdzmZ6mEw9kABl8UlttzQoOB6PR5RZbwif3++nWZI5RThW3EwF+yChvLY/mhbC2nPPyRMPldFGolu7WltY4+OT0rXqamukrbmpKesaE+MTUCRUQ6VOB51o6Uhk6TlhGXJ7GCdxkOqZsAEPcmXcWYUFAQ/ytEc1NTVhJVYjVM3TxMREqxKQKzGWEl/J/puFCgsdXn6UOgsqMRY9Ry8XLRRjWfZ7JDysQYQoyJdfs5mpAKVWmOGnFVESLFRwkpi8STVE5XlGMD5K+zPSIFLNkIJyrOnHMi2PVUoeUCkCpecqOays3JNWDmuhopb/UsQhP49hxSstAiO5LLf4P0PxfV6hvePgAAAAAElFTkSuQmCC";
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import FlutterMacOS
import Foundation

import path_provider_macos
import path_provider_foundation
import sqflite
import url_launcher_macos

Expand Down
1 change: 1 addition & 0 deletions cached_network_image/lib/cached_network_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export 'package:flutter_cache_manager/flutter_cache_manager.dart'
export 'src/cached_image_widget.dart';
export 'src/image_provider/cached_network_image_provider.dart';
export 'src/image_provider/multi_image_stream_completer.dart';
export 'src/image_provider/cached_memory_image.dart';
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';

/// Image widget to show MemoryImage with caching functionality.
class CachedMemoryImageProvider extends ImageProvider<CachedMemoryImageProvider> {
///the cache id use to get cache
final String tag;

///the bytes of image to cache
final Uint8List img;
/// CachedMemoryImageProvider shows a memory image lazily using a caching mechanism
CachedMemoryImageProvider(this.tag, this.img);

/// Converts a key into an [ImageStreamCompleter], and begins fetching the
/// image.
@override
ImageStreamCompleter loadImage(
CachedMemoryImageProvider key, ImageDecoderCallback decode) {
return MultiFrameImageStreamCompleter(
codec: _loadAsync(decode),
scale: 1.0,
debugLabel: tag,
informationCollector: () sync* {
yield ErrorDescription('Tag: $tag');
},
);
}

Future<Codec> _loadAsync(ImageDecoderCallback decode) async {
/// the DefaultCacheManager() encapsulation, it get cache from local storage.
final Uint8List bytes = img;
/// The file may become available later.
if (bytes.lengthInBytes == 0) {
PaintingBinding.instance.imageCache.evict(this);
throw StateError('$tag is empty and cannot be loaded as an image.');
}
final buffer = await ImmutableBuffer.fromUint8List(bytes);

return await decode(buffer);
}

@override
Future<CachedMemoryImageProvider> obtainKey(ImageConfiguration configuration) {
return SynchronousFuture<CachedMemoryImageProvider>(this);
}

@override
bool operator ==(Object other) {
if (other.runtimeType != runtimeType) return false;
bool res = other is CachedMemoryImageProvider && other.tag == tag;
return res;
}

@override
int get hashCode => tag.hashCode;

@override
String toString() => '${objectRuntimeType(this, 'CachedImageProvider')}("$tag")';
}