frameBuilder property
A builder function responsible for creating the widget that represents this image.
The following sample demonstrates how to use this builder to implement an image that fades in once it's been loaded.
This sample contains a limited subset of the functionality that the FadeInImage widget provides out of the box.
@override
Widget build(BuildContext context) {
return DecoratedBox(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(),
borderRadius: BorderRadius.circular(20),
),
child: Image.network(
'https://flutter.github.io/assets-for-api-docs/assets/widgets/puffin.jpg',
frameBuilder: (BuildContext context, Widget child, int? frame, bool wasSynchronouslyLoaded) {
if (wasSynchronouslyLoaded) {
return child;
}
return AnimatedOpacity(
child: child,
opacity: frame == null ? 0 : 1,
duration: const Duration(seconds: 1),
curve: Curves.easeOut,
);
},
),
);
}
From flutter documentation
Implementation
final Widget Function(BuildContext, Widget, int?, bool)? frameBuilder;