Viewing version 0.9.1. Open the latest package page.
flutter_blurhash
0.9.1Compact representation of placeholder for an image. Encode a blurry image under 30 characters for instant display like used by Medium
Readme
Flutter Community: flutter_blurhash
flutter_blurhash
Blurhash is compact representation of a blurred image, often used fo
This package implements the blurhash-decoding algorithm in pure Dart and provides the BlurHash widget that displays
the blurhash and can transition into the actual image once it is loaded.
It doesn't currently support encoding of Blurhash.
Generation
A fast and easy way to get a blurhash for your image is to upload it to https://blurha.sh.
Example
Constrain your widget's render area and let BlurHash fill the pixels.
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text("BlurHash")),
body: const SizedBox.expand(
child: Center(
child: AspectRatio(
aspectRatio: 1.6,
child: BlurHash(hash: "L5H2EC=PM+yV0g-mq.wG9c010J}I"),
),
),
),
),
);
}
}
Optimization Modes
- None (
BlurHashOptimizationMode.none): The original algorithm, provided for backward compatibility. - Standard (
BlurHashOptimizationMode.standard): Optimized decoding with better cache locality and performance. - Approximation (
BlurHashOptimizationMode.approximation): Fastest mode with an approximated sRGB conversion that produces slightly darker results but significantly improves performance.
class BlurHashApp extends StatelessWidget {
const BlurHashApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) => MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text("BlurHash")),
body: const SizedBox.expand(
child: Center(
child: AspectRatio(
aspectRatio: 1.6,
child: BlurHash(
hash: "L5H2EC=PM+yV0g-mq.wG9c010J}I",
optimizationMode: BlurHashOptimizationMode.approximation,
),
),
),
),
),
);
}
Changelog
0.9.1
- Corrections
0.9.0
- Performance by Raouf Rahiche
0.8.1
- Code review
0.8.0
- Flutter 3.0 as min required version
0.7.0
- Add validateBlurhash() method
0.6.8
- ImageNetwork can receive an errorBuilder
0.6.7
- Rollback call to compute() and isolates as performances are down
0.6.6
- Add headers for secure auth calls
0.6.4
- onDecoded() and onDisplayed() events
0.6.2
- package update
0.6.0
- stable release for flutter 2.0
0.5.4-nullsafety.0
- nullsafety.1
0.5.2-nullsafety.0
- nullsafety.0
0.5.1
- Update dependencies
0.5.0
- Flutter Web compatibility thanks to @deakjahn
0.4.2
- Remove dependency on Image package
0.4.1
- Correction with Object Type method that is internal only
0.4.0
- Direct ImageProvider by Rene Floor
0.3.0
- Events registration to sync your animations
0.2.1
- Automatic network image load with FadeIn Effect
0.2.0+3
- Temporary removed ColoredBox until it lands on stable channel
0.2.0+2
- Code cleanup
0.2.0
- Cleaned up BlurHash Widget
- Refactored and cleaned up decoder to a global method.
- Moved package to Flutter Community
0.1.2
- Performances and extended list as example
0.1.1
- Documentation and cleanup
0.1.0
- Released the decoder and basic widget
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'flutter_blurhash:0.9.1'pubspec.yaml
name: flutter_blurhash
description: >
Compact representation of placeholder for an image.
Encode a blurry image under 30 characters for instant display like used by Medium
version: 0.9.1
homepage: https://github.com/fluttercommunity/flutter_blurhash
repository: https://github.com/fluttercommunity/flutter_blurhash
issue_tracker: https://github.com/fluttercommunity/flutter_blurhash/issues
maintainer: Robert Felker (@Solido)
screenshots:
- description: 'Content preview as blurred buffer.'
path: screenshots/blurred.png
- description: 'Content loaded.'
path: screenshots/loaded.png
environment:
# flutter: ">=3.16.0"
sdk: ">=3.0.0 <4.0.0"
dependencies:
flutter:
sdk: flutter
dev_dependencies:
flutter_lints:
flutter_test:
sdk: flutter
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0 | Cached · Upstream SHA-256 matched | Download | d1abdaba…87110f |
| 0.1.1 | Cached · Upstream SHA-256 matched | Download | 098f93fa…430c48 |
| 0.1.2 | Cached · Upstream SHA-256 matched | Download | 271cb270…6ae85e |
| 0.2.0 | Cached · Upstream SHA-256 matched | Download | 01fbfb39…769b39 |
| 0.2.0+1 | Cached · Upstream SHA-256 matched | Download | 8dc220c1…43a653 |
| 0.2.0+2 | Cached · Upstream SHA-256 matched | Download | bea51615…f1ba13 |
| 0.2.0+3 | Cached · Upstream SHA-256 matched | Download | 3048c578…a66731 |
| 0.2.1 | Cached · Upstream SHA-256 matched | Download | ef86ce9b…fe8596 |
| 0.4.0 | Cached · Upstream SHA-256 matched | Download | 0504357f…52849e |
| 0.4.1 | Cached · Upstream SHA-256 matched | Download | 7870b635…87fca6 |
| 0.4.2 | Cached · Upstream SHA-256 matched | Download | b3bc4bbd…b78503 |
| 0.5.0 | Cached · Upstream SHA-256 matched | Download | 339d896c…8a9230 |
| 0.5.2-nullsafety.0 | Cached · Upstream SHA-256 matched | Download | 60d83750…e8a21c |
| 0.5.4-nullsafety.0 | Cached · Upstream SHA-256 matched | Download | 7aad8d0d…20590b |
| 0.6.0 | Cached · Upstream SHA-256 matched | Download | 3525f13a…d1f8c0 |
| 0.6.4 | Cached · Upstream SHA-256 matched | Download | 1a4a4973…96a4ed |
| 0.6.6 | Cached · Upstream SHA-256 matched | Download | 933b9e6a…dec0d3 |
| 0.6.7 | Cached · Upstream SHA-256 matched | Download | eb69353a…2c4d87 |
| 0.6.8 | Cached · Upstream SHA-256 matched | Download | 93f1c766…44444d |
| 0.7.0 | Cached · Upstream SHA-256 matched | Download | 05001537…31a5c6 |
| 0.8.0 | Cached · Upstream SHA-256 matched | Download | 0592f6ef…ad6bfe |
| 0.8.1 | Cached · Upstream SHA-256 matched | Download | 3af40992…4e5d11 |
| 0.8.2 | Cached · Upstream SHA-256 matched | Download | 5e67678e…db0c06 |
| 0.9.0 | Cached · Upstream SHA-256 matched | Download | d4724671…c2fb39 |
| 0.9.1 | Cached · Upstream SHA-256 matched | Download | e97b9aff…e3d25d |
Dependencies
flutter {
"sdk": "flutter"
}