Skip to content
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
21 changes: 15 additions & 6 deletions lib/src/blurhash_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,13 @@ class BlurHashState extends State<BlurHash> {
/// Decode the blurhash then display the resulting Image
Widget buildBlurHashBackground() => FutureBuilder<ui.Image>(
future: _image,
builder: (ctx, snap) =>
snap.hasData ? Image(image: UiImage(snap.data!), fit: widget.imageFit) : Container(color: widget.color),
builder: (ctx, snap) => snap.hasData
? Image(
image: UiImage(snap.data!),
fit: widget.imageFit,
errorBuilder: widget.errorBuilder,
)
: Container(color: widget.color),
);
}

Expand All @@ -175,7 +180,8 @@ class _DisplayImage extends StatefulWidget {
_DisplayImageState createState() => _DisplayImageState();
}

class _DisplayImageState extends State<_DisplayImage> with SingleTickerProviderStateMixin {
class _DisplayImageState extends State<_DisplayImage>
with SingleTickerProviderStateMixin {
late Animation<double> opacity;
late AnimationController controller;

Expand Down Expand Up @@ -212,10 +218,12 @@ class UiImage extends ImageProvider<UiImage> {
const UiImage(this.image, {this.scale = 1.0});

@override
Future<UiImage> obtainKey(ImageConfiguration configuration) => SynchronousFuture<UiImage>(this);
Future<UiImage> obtainKey(ImageConfiguration configuration) =>
SynchronousFuture<UiImage>(this);

@override
ImageStreamCompleter load(UiImage key, DecoderCallback decode) => OneFrameImageStreamCompleter(_loadAsync(key));
ImageStreamCompleter load(UiImage key, DecoderCallback decode) =>
OneFrameImageStreamCompleter(_loadAsync(key));

Future<ImageInfo> _loadAsync(UiImage key) async {
assert(key == this);
Expand All @@ -233,5 +241,6 @@ class UiImage extends ImageProvider<UiImage> {
int get hashCode => hashValues(image.hashCode, scale);

@override
String toString() => '$runtimeType(${describeIdentity(image)}, scale: $scale)';
String toString() =>
'$runtimeType(${describeIdentity(image)}, scale: $scale)';
}