import 'package:auto_route/auto_route.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:story/story.dart'; class StoriesPage extends StatelessWidget { StoriesPage(); @override Widget build(BuildContext context) { final topPadding = MediaQuery.of(context).padding.top; return Scaffold( body: StoryPageView( indicatorHeight: 4.0, indicatorPadding: EdgeInsets.symmetric( vertical: topPadding + 8.0, horizontal: 8.0, ), onPageLimitReached: () { Navigator.pop(context); }, gestureItemBuilder: (context, story, page) => Stack( children: [ Positioned( top: topPadding + 24.0, left: 12.0, child: IconButton( onPressed: () { Navigator.pop(context); }, icon: Icon(Icons.clear), ), ), ], ), itemBuilder: (c, pageIndex, storyIndex) { return Container( color: Colors.redAccent, alignment: Alignment.center, child: Text( "Index of PageView: $pageIndex Index of story on each page: $storyIndex"), ); }, storyLength: (pageIndex) { return 1; }, pageLength: 2, ), ); } }