FadeInImage constructor
- Key? key,
- required ImageProvider<
Object> placeholder, - ImageErrorWidgetBuilder? placeholderErrorBuilder,
- required ImageProvider<
Object> image, - ImageErrorWidgetBuilder? imageErrorBuilder,
- bool excludeFromSemantics = false,
- String? imageSemanticLabel,
- Duration? fadeOutDuration,
- Curve? fadeOutCurve,
- Duration fadeInDuration = const Duration(milliseconds: 700),
- Curve fadeInCurve = Curves.easeIn,
- Color? color,
- BlendMode? colorBlendMode,
- Color? placeholderColor,
- BlendMode? placeholderColorBlendMode,
- double? width,
- double? height,
- BoxFit? fit,
- BoxFit? placeholderFit,
- FilterQuality filterQuality = FilterQuality.medium,
- FilterQuality? placeholderFilterQuality,
- AlignmentGeometry alignment = Alignment.center,
- ImageRepeat repeat = ImageRepeat.noRepeat,
- bool matchTextDirection = false,
- FadeInImageTransition transition = FadeInImageTransition.sequential,
Creates a widget that displays a placeholder while an image is loading,
then transitions to the image according to transition.
By default (FadeInImageTransition.sequential), the placeholder fades out
and then the image fades in. Set transition to
FadeInImageTransition.fadeInOver to instead fade the image in on top of
the placeholder; in that case fadeOutDuration and fadeOutCurve must be
omitted or null.
The placeholder and image may be composed in a ResizeImage to provide
a custom decode/cache size.
The placeholder and image may have their own BoxFit settings via fit
and placeholderFit.
The placeholder and image may have their own FilterQuality settings via filterQuality
and placeholderFilterQuality.
If excludeFromSemantics is true, then imageSemanticLabel will be ignored.
Implementation
const FadeInImage({
super.key,
required this.placeholder,
this.placeholderErrorBuilder,
required this.image,
this.imageErrorBuilder,
this.excludeFromSemantics = false,
this.imageSemanticLabel,
Duration? fadeOutDuration,
Curve? fadeOutCurve,
this.fadeInDuration = const Duration(milliseconds: 700),
this.fadeInCurve = Curves.easeIn,
this.color,
this.colorBlendMode,
this.placeholderColor,
this.placeholderColorBlendMode,
this.width,
this.height,
this.fit,
this.placeholderFit,
this.filterQuality = FilterQuality.medium,
this.placeholderFilterQuality,
this.alignment = Alignment.center,
this.repeat = ImageRepeat.noRepeat,
this.matchTextDirection = false,
this.transition = FadeInImageTransition.sequential,
}) : assert(
transition != FadeInImageTransition.fadeInOver ||
(fadeOutDuration == null && fadeOutCurve == null),
'fadeOutDuration and fadeOutCurve must be omitted or null when '
'transition is FadeInImageTransition.fadeInOver, since the placeholder '
'is not faded out in that mode.',
),
fadeOutDuration = fadeOutDuration ?? _defaultFadeOutDuration,
fadeOutCurve = fadeOutCurve ?? _defaultFadeOutCurve;