Comments (4)
For those interested, I fixed on my side by introducing this class :
class OctoBlurHashFix {
static OctoPlaceholderBuilder placeHolder(String hash, {BoxFit? fit}) {
return (context) => SizedBox.expand(
child: Image(
image: BlurHashImage(hash),
fit: fit ?? BoxFit.cover,
),
);
}
static OctoErrorBuilder error(
String hash, {
BoxFit? fit,
Text? message,
IconData? icon,
Color? iconColor,
double? iconSize,
}) {
return OctoError.placeholderWithErrorIcon(
placeHolder(hash, fit: fit),
message: message,
icon: icon,
iconColor: iconColor,
iconSize: iconSize,
);
}
}
Then, replace your usages of OctoError.blurhash and OctoPlaceholder.blurhash :
OctoImage(
colorBlendMode: BlendMode.modulate,
fit: BoxFit.cover,
image: CachedNetworkImageProvider(imageUrl),
placeholderBuilder: OctoBlurHashFix.placeHolder(placeHolderBlurHashString),
errorBuilder: OctoBlurHashFix.error(errorBlurHashString, iconColor: Colors.transparent),
),
You may also have to add the blurhash dependency
flutter_blurhash: ^0.8.2
from octo_image.
I'm also using OctoImage with blurHash and it works great for ^1.0.2. It'd be great if you could document how to migrate to ^2.0.0 and overcome this.
from octo_image.
same .blurHash is not defined
from octo_image.
/// Simple set to show [OctoPlaceholder.circularProgressIndicator] as
/// placeholder and [OctoError.icon] as error.
OctoSet blurHash(
String hash, {
BoxFit? fit,
Text? errorMessage,
}) {
return OctoSet(
placeholderBuilder: blurHashPlaceholderBuilder(hash, fit: fit),
errorBuilder: blurHashErrorBuilder(hash, fit: fit),
);
}
OctoPlaceholderBuilder blurHashPlaceholderBuilder(String hash, {BoxFit? fit}) {
return (context) => SizedBox.expand(
child: Image(
image: BlurHashImage(hash),
fit: fit ?? BoxFit.cover,
),
);
}
OctoErrorBuilder blurHashErrorBuilder(
String hash, {
BoxFit? fit,
Text? message,
IconData? icon,
Color? iconColor,
double? iconSize,
}) {
return OctoError.placeholderWithErrorIcon(
blurHashPlaceholderBuilder(hash, fit: fit),
message: message,
icon: icon,
iconColor: iconColor,
iconSize: iconSize,
);
}
is this the way?
from octo_image.
Related Issues (17)
- reportError throws assertion: setState() called after dispose() HOT 7
- [Regression] BoxFit cover for placeholder and error builders HOT 5
- extend OctoImage-->imageBuilder to also include the imageprovider HOT 3
- Inkwell effect on image
- gaplessPlayback broken: Bad state: Cannot clone a disposed image. HOT 13
- Image decode complete notification
- Memory leak and crash with gapless HOT 2
- Errors and crashes on removed `OctoImage` widget HOT 2
- flutter master channel build failed HOT 2
- problem in The method 'blurHash' isn't defined for the type 'OctoPlaceholder'. Try correcting the name to the name of an existing method, or defining a method named 'blurHash'.dartundefined_method Type: InvalidType
- i am getting issue "The method 'blurHash' isn't defined for the type 'OctoPlaceholder'"
- Fade transition not disposing child when duration is zero
- gaplessPlayback doesn't fade
- [web] support for new CanvasKit HOT 17
- Size is infinite although width and or height are set. HOT 3
- Cant we change error icon size for this widget OctoError.blurHash(hash) ? Cant we let user decide which icon to use?? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from octo_image.