StoryItem.inlineImage constructor

StoryItem.inlineImage({
  1. required String url,
  2. Text? caption,
  3. required StoryController controller,
  4. Key? key,
  5. BoxFit imageFit = BoxFit.cover,
  6. Map<String, dynamic>? requestHeaders,
  7. bool shown = false,
  8. bool roundedTop = true,
  9. bool roundedBottom = false,
  10. Widget? loadingWidget,
  11. Widget? errorWidget,
  12. EdgeInsetsGeometry? captionOuterPadding,
  13. Duration? duration,
})

Shorthand for creating inline image. controller should be same instance as one passed to the StoryView

Implementation

factory StoryItem.inlineImage({
  required String url,
  Text? caption,
  required StoryController controller,
  Key? key,
  BoxFit imageFit = BoxFit.cover,
  Map<String, dynamic>? requestHeaders,
  bool shown = false,
  bool roundedTop = true,
  bool roundedBottom = false,
  Widget? loadingWidget,
  Widget? errorWidget,
  EdgeInsetsGeometry? captionOuterPadding,
  Duration? duration,
}) {
  return StoryItem(
    ClipRRect(
      key: key,
      child: Container(
        color: Colors.grey[100],
        child: Container(
          color: Colors.black,
          child: Stack(
            children: <Widget>[
              StoryImage.url(
                url,
                controller: controller,
                fit: imageFit,
                requestHeaders: requestHeaders,
                loadingWidget: loadingWidget,
                errorWidget: errorWidget,
              ),
              Container(
                margin: EdgeInsets.only(bottom: 16),
                padding: captionOuterPadding?? EdgeInsets.symmetric(horizontal: 24, vertical: 8),
                child: Align(
                  alignment: Alignment.bottomLeft,
                  child: Container(
                    child: caption?? const SizedBox.shrink(),
                    width: double.infinity,
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
      borderRadius: BorderRadius.vertical(
        top: Radius.circular(roundedTop ? 8 : 0),
        bottom: Radius.circular(roundedBottom ? 8 : 0),
      ),
    ),
    shown: shown,
    duration: duration ?? Duration(seconds: 3),
  );
}