StoryItem.pageProviderImage constructor
StoryItem.pageProviderImage(})
Shorthand for creating a story item from an image provider such as AssetImage
or NetworkImage
. However, the story continues to play while the image loads
up.
Implementation
factory StoryItem.pageProviderImage(
ImageProvider image, {
Key? key,
BoxFit imageFit = BoxFit.fitWidth,
String? caption,
bool shown = false,
Duration? duration,
}) {
return StoryItem(
Container(
key: key,
color: Colors.black,
child: Stack(
children: <Widget>[
Center(
child: Image(
image: image,
height: double.infinity,
width: double.infinity,
fit: imageFit,
),
),
SafeArea(
child: Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double.infinity,
margin: EdgeInsets.only(
bottom: 24,
),
padding: EdgeInsets.symmetric(
horizontal: 24,
vertical: 8,
),
color:
caption != null ? Colors.black54 : Colors.transparent,
child: caption != null
? Text(
caption,
style: TextStyle(
fontSize: 15,
color: Colors.white,
),
textAlign: TextAlign.center,
)
: SizedBox(),
),
),
)
],
),
),
shown: shown,
duration: duration ?? Duration(seconds: 3));
}