StoryItem.pageVideo constructor

StoryItem.pageVideo(
  1. String url, {
  2. required StoryController controller,
  3. Key? key,
  4. Duration? duration,
  5. BoxFit imageFit = BoxFit.fitWidth,
  6. Widget? caption,
  7. bool shown = false,
  8. Map<String, dynamic>? requestHeaders,
  9. Widget? loadingWidget,
  10. Widget? errorWidget,
})

Shorthand for creating page video. controller should be same instance as one passed to the StoryView

Implementation

factory StoryItem.pageVideo(
  String url, {
  required StoryController controller,
  Key? key,
  Duration? duration,
  BoxFit imageFit = BoxFit.fitWidth,
  Widget? caption,
  bool shown = false,
  Map<String, dynamic>? requestHeaders,
  Widget? loadingWidget,
  Widget? errorWidget,
}) {
  return StoryItem(
      Container(
        key: key,
        color: Colors.black,
        child: Stack(
          children: <Widget>[
            StoryVideo.url(
              url,
              controller: controller,
              requestHeaders: requestHeaders,
              loadingWidget: loadingWidget,
              errorWidget: errorWidget,
            ),
            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?? const SizedBox.shrink(),
                ),
              ),
            )
          ],
        ),
      ),
      shown: shown,
      duration: duration ?? Duration(seconds: 10));
}