santa112358 / story

Instagram stories like UI with rich animations and customizability.
https://pub.dev/packages/story
MIT License
37 stars 55 forks source link

indicatorAnimationController not pause when set value to IndicatorAnimationCommand.pause #43

Open Alemartech opened 1 year ago

gideonoyekale commented 1 year ago

same issue

santa112358 commented 1 year ago

@Alemartech @gideonoyekale Can you give me a sample code of the case that does not work?

TitikUniverse commented 1 year ago

@santa112358 santa112358 Same issue. Despite the fact that in initState I immediately initialized as "pause", the playback of the story began immediately. It's impossible to stop it.

iPhone 12 (iOS 16.3)^ Flutter 3.7.2

@override
  void initState() {
    super.initState();
    initializeDateFormatting();
    indicatorAnimationController = ValueNotifier<IndicatorAnimationCommand>(IndicatorAnimationCommand.pause);
  }

StoryPageView(
        initialPage: widget.index,
        indicatorPadding: const EdgeInsets.symmetric(vertical: 52, horizontal: 8),
        indicatorAnimationController: indicatorAnimationController,
        onPageLimitReached:() => Navigator.pop(context),
        pageLength: feedStories.length,
        storyLength: (pageIndex) => feedStories[pageIndex].items.length,
        itemBuilder: (context, pageIndex, storyIndex) {
          final story = feedStories[pageIndex].items[storyIndex];
          final isVideo = _isVideo(story.contentUrl);
          return Stack(
            fit: StackFit.expand,
            children: [
              Container(
                color: Colors.black,
              ),
              if (isVideo) VideoItem(
                videoUrl: story.contentUrl,
              )
              else StoryImage(
                key: ValueKey(story.contentUrl),
                imageProvider: CachedNetworkImageProvider(
                  story.contentUrl
                ),
              )
            ],
          );
        },
      )

write to me at titikuniverse@gmail.com if you need more details or reply to this comment

TitikUniverse commented 1 year ago

I am 100% sure that if you do not use the Story Image() widget, then it is impossible to stop scrolling through stories. And if you use this widget, then at least until the history is loaded - everything is stopped, but stop through the indicatorAnimationController.value = IndicatorAnimationCommand.pause; is not possible

TitikUniverse commented 1 year ago

I just found out that after executing my code, the story starts over, but still keeps replaying. However, this behavior is typical only for the first pause call. On the second and subsequent runs of my code, nothing happens (it doesn't even rewind to the beginning)

@override
  void initState() {
  super.initState();
  indicatorAnimationController = ValueNotifier<IndicatorAnimationCommand>(IndicatorAnimationCommand.resume);
}

...

indicatorAnimationController.value = IndicatorAnimationCommand.pause;
GoRouter.of(context).push('/${feedStories[pageIndex].author.nickname}');
heshesh2010 commented 1 year ago

+1

mirsaiddev commented 1 year ago

same here

Rgada28 commented 1 month ago

Facing Same issue on web as well