pageImage static method

StoryItem pageImage(
  1. ImageProvider<Object> image, {
  2. BoxFit imageFit = BoxFit.fitWidth,
  3. String? caption,
  4. bool shown = false,
  5. Duration duration = const Duration(seconds: 3),
})

Shorthand for a full-page image content.

You can provide any image provider for image.

Implementation

static StoryItem pageImage(
  ImageProvider image, {
  BoxFit imageFit = BoxFit.fitWidth,
  String? caption,
  bool shown = false,
  Duration duration = const Duration(seconds: 3),
}) {
  return StoryItem(
    Container(
      color: Colors.black,
      child: Stack(
        children: <Widget>[
          Center(
            child: Image(
              image: image,
              height: double.infinity,
              width: double.infinity,
              fit: imageFit,
            ),
          ),
          caption != null && caption.length > 0
              ? SafeArea(
                  child: Align(
                    alignment: Alignment.bottomCenter,
                    child: Container(
                      width: double.infinity,
                      margin: EdgeInsets.only(
                        bottom: 24,
                      ),
                      padding: EdgeInsets.symmetric(
                        horizontal: 24,
                        vertical: 8,
                      ),
                      color: Colors.black54,
                      child: Text(
                        caption,
                        style: TextStyle(
                          fontSize: 15,
                          color: Colors.white,
                        ),
                        textAlign: TextAlign.center,
                      ),
                    ),
                  ),
                )
              : Container(),
        ],
      ),
    ),
    shown: shown,
    duration: duration,
  );
}