Story class

Widget that allows you to use stories mechanism in your apps

Usage:

Story(
  onFlashForward: Navigator.of(context).pop,
  onFlashBack: Navigator.of(context).pop,
  momentCount: 4,
  momentDurationGetter: (idx) => Duration(seconds: 4),
  momentBuilder: (context, idx) {
    return Container(
      color: CupertinoColors.destructiveRed,
      child: Center(
        child: Text(
          'Moment ${idx + 1}',
          style: TextStyle(color: CupertinoColors.white),
        ),
      ),
    );
  },
)
Inheritance

Constructors

Story({Key? key, required IndexedWidgetBuilder momentBuilder, required MomentDurationGetter momentDurationGetter, required int momentCount, VoidCallback? onFlashForward, VoidCallback? onFlashBack, ProgressSegmentBuilder progressSegmentBuilder = Story.instagramProgressSegmentBuilder, double progressSegmentGap = 2.0, Duration progressOpacityDuration = const Duration(milliseconds: 300), double momentSwitcherFraction = 0.33, int startAt = 0, double? topOffset, bool fullscreen = true})
const

Properties

fullscreen bool
Controls fullscreen behavior
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
momentBuilder IndexedWidgetBuilder
Builder that gets executed executed for each moment
final
momentCount int
Sets the number of moments in story
final
momentDurationGetter MomentDurationGetter
Function that must return Duration for each moment
final
momentSwitcherFraction double
Sets the ratio of left and right tappable portions of the screen: left for switching back, right for switching forward
final
onFlashBack VoidCallback?
Gets executed when user taps the left portion of the screen on the first moment in story
final
onFlashForward VoidCallback?
Gets executed when user taps the right portion of the screen on the last moment in story or when story finishes playing
final
progressOpacityDuration Duration
Sets the duration for the progress bar show/hide animation
final
progressSegmentBuilder ProgressSegmentBuilder
Builder for each progress segment Defaults to Instagram-like minimalistic segment builder
final
progressSegmentGap double
Sets the gap between each progress segment
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startAt int
Sets the index of the first moment that will be displayed
final
topOffset double?
Controls progress segments's container oofset from top of the screen
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _StoryState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

instagramProgressSegmentBuilder(BuildContext context, int index, double progress, double gap) Widget