Skip to content

Add optimizationMode for BlurHashImage #73

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions lib/src/blurhash_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class BlurHashImage extends ImageProvider<BlurHashImage> {
const BlurHashImage(this.blurHash,
{this.decodingWidth = _DEFAULT_SIZE,
this.decodingHeight = _DEFAULT_SIZE,
this.optimizationMode = BlurHashOptimizationMode.none,
this.scale = 1.0});

/// The bytes to decode into an image.
Expand All @@ -27,6 +28,9 @@ class BlurHashImage extends ImageProvider<BlurHashImage> {
/// Decoding definition
final int decodingHeight;

/// The optimization mode to use for decoding
final BlurHashOptimizationMode optimizationMode;

@override
Future<BlurHashImage> obtainKey(ImageConfiguration configuration) =>
SynchronousFuture<BlurHashImage>(this);
Expand All @@ -43,6 +47,7 @@ class BlurHashImage extends ImageProvider<BlurHashImage> {
blurHash: blurHash,
width: decodingWidth,
height: decodingHeight,
optimizationMode: optimizationMode,
);
return ImageInfo(image: image, scale: key.scale);
}
Expand Down