diff --git a/lib/widgets/story_view.dart b/lib/widgets/story_view.dart index 3a6e8db1..987bd6d5 100644 --- a/lib/widgets/story_view.dart +++ b/lib/widgets/story_view.dart @@ -79,10 +79,11 @@ class StoryItem { bottom: Radius.circular(roundedBottom ? 8 : 0), ), ), - padding: textOuterPadding?? EdgeInsets.symmetric( - horizontal: 24, - vertical: 16, - ), + padding: textOuterPadding ?? + EdgeInsets.symmetric( + horizontal: 24, + vertical: 16, + ), child: Center( child: Text( title, @@ -140,12 +141,13 @@ class StoryItem { margin: EdgeInsets.only( bottom: 24, ), - padding: captionOuterPadding?? EdgeInsets.symmetric( - horizontal: 24, - vertical: 8, - ), + padding: captionOuterPadding ?? + EdgeInsets.symmetric( + horizontal: 24, + vertical: 8, + ), color: caption != null ? Colors.black54 : Colors.transparent, - child: caption?? const SizedBox.shrink(), + child: caption ?? const SizedBox.shrink(), ), ), ) @@ -193,11 +195,12 @@ class StoryItem { ), Container( margin: EdgeInsets.only(bottom: 16), - padding: captionOuterPadding?? EdgeInsets.symmetric(horizontal: 24, vertical: 8), + padding: captionOuterPadding ?? + EdgeInsets.symmetric(horizontal: 24, vertical: 8), child: Align( alignment: Alignment.bottomLeft, child: Container( - child: caption?? const SizedBox.shrink(), + child: caption ?? const SizedBox.shrink(), width: double.infinity, ), ), @@ -252,7 +255,7 @@ class StoryItem { padding: EdgeInsets.symmetric(horizontal: 24, vertical: 8), color: caption != null ? Colors.black54 : Colors.transparent, - child: caption?? const SizedBox.shrink(), + child: caption ?? const SizedBox.shrink(), ), ), ) @@ -406,6 +409,7 @@ class StoryView extends StatefulWidget { /// Indicator Color final Color? indicatorColor; + /// Indicator Foreground Color final Color? indicatorForegroundColor; @@ -427,7 +431,10 @@ class StoryView extends StatefulWidget { this.indicatorColor, this.indicatorForegroundColor, this.indicatorHeight = IndicatorHeight.large, - this.indicatorOuterPadding = const EdgeInsets.symmetric(horizontal: 16, vertical: 8,), + this.indicatorOuterPadding = const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), }); @override @@ -634,31 +641,6 @@ class StoryViewState extends State with TickerProviderStateMixin { child: Stack( children: [ _currentView, - Visibility( - visible: widget.progressPosition != ProgressPosition.none, - child: Align( - alignment: widget.progressPosition == ProgressPosition.top - ? Alignment.topCenter - : Alignment.bottomCenter, - child: SafeArea( - bottom: widget.inline ? false : true, - // we use SafeArea here for notched and bezeles phones - child: Container( - padding: widget.indicatorOuterPadding, - child: PageBar( - widget.storyItems - .map((it) => PageData(it!.duration, it.shown)) - .toList(), - this._currentAnimation, - key: UniqueKey(), - indicatorHeight: widget.indicatorHeight, - indicatorColor: widget.indicatorColor, - indicatorForegroundColor: widget.indicatorForegroundColor, - ), - ), - ), - ), - ), Align( alignment: Alignment.centerRight, heightFactor: 1, @@ -721,6 +703,31 @@ class StoryViewState extends State with TickerProviderStateMixin { }), width: 70), ), + Visibility( + visible: widget.progressPosition != ProgressPosition.none, + child: Align( + alignment: widget.progressPosition == ProgressPosition.top + ? Alignment.topCenter + : Alignment.bottomCenter, + child: SafeArea( + bottom: widget.inline ? false : true, + // we use SafeArea here for notched and bezeles phones + child: Container( + padding: widget.indicatorOuterPadding, + child: PageBar( + widget.storyItems + .map((it) => PageData(it!.duration, it.shown)) + .toList(), + this._currentAnimation, + key: UniqueKey(), + indicatorHeight: widget.indicatorHeight, + indicatorColor: widget.indicatorColor, + indicatorForegroundColor: widget.indicatorForegroundColor, + ), + ), + ), + ), + ), ], ), ); @@ -796,8 +803,11 @@ class PageBarState extends State { right: widget.pages.last == it ? 0 : this.spacing), child: StoryProgressIndicator( isPlaying(it) ? widget.animation!.value : (it.shown ? 1 : 0), - indicatorHeight: - widget.indicatorHeight == IndicatorHeight.large ? 5 : widget.indicatorHeight == IndicatorHeight.medium ? 3 : 2, + indicatorHeight: widget.indicatorHeight == IndicatorHeight.large + ? 5 + : widget.indicatorHeight == IndicatorHeight.medium + ? 3 + : 2, indicatorColor: widget.indicatorColor, indicatorForegroundColor: widget.indicatorForegroundColor, ), @@ -831,11 +841,11 @@ class StoryProgressIndicator extends StatelessWidget { this.indicatorHeight, ), foregroundPainter: IndicatorOval( - this.indicatorForegroundColor?? Colors.white.withOpacity(0.8), + this.indicatorForegroundColor ?? Colors.white.withOpacity(0.8), this.value, ), painter: IndicatorOval( - this.indicatorColor?? Colors.white.withOpacity(0.4), + this.indicatorColor ?? Colors.white.withOpacity(0.4), 1.0, ), );