A package provides an easy way to show horizontal progress like instagram stories in Flutter project
import 'package:story_progress/story_progress.dart';
var _formKey = GlobalKey<StoryProgressState>();
var _play = false;
StoryProgress(
key: _formKey,
progressCount: 4,
width: width,
duration: Duration(seconds: 3),
onStatusChanged: (value) {
WidgetsBinding.instance.addPostFrameCallback((_) {
switch (value) {
case Status.next:
//
break;
case Status.previous:
//
break;
case Status.completed:
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('Stories completed'),
duration: Duration(seconds: 1),
));
break;
}
});
},
)
Use this function on onPressed event
_formKey.currentState.skip();
_formKey.currentState.previous();
Use this function on onPressed event
_formKey.currentState.pause();
_formKey.currentState.resume(); //