Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i get Current Position of shown Story ? #97

Closed
mdpe-ir opened this issue Apr 2, 2021 · 2 comments
Closed

How can i get Current Position of shown Story ? #97

mdpe-ir opened this issue Apr 2, 2021 · 2 comments

Comments

@mdpe-ir
Copy link

mdpe-ir commented Apr 2, 2021

How can i get Current Position of shown Story onStoryShow Function

@Marco4763
Copy link

Marco4763 commented Apr 2, 2021

Go to your pubspec.yaml and use this version:

story_view:
    git:
      url: git://github.com/Marco4763/story_view.git
      ref: movement-support

You will have to add the position manually when you put the storyItems like this:

storyItems: [
          StoryItem.text(
            title: "I guess you'd love to see more of our food. That's great.",
            backgroundColor: Colors.blue,
            position: 1
          ),
          StoryItem.text(
            title: "Nice!\n\nTap to continue.",
            backgroundColor: Colors.red,
            textStyle: TextStyle(
              fontFamily: 'Dancing',
              fontSize: 40,
            ),
            position: 2
          ),
]

And then you can get it on onStoryShow Function, like this:

onStoryShow: (s) {
          print("Showing the position ${s.position}");
        }

Very simple, please reply if it works.

@blackmann
Copy link
Owner

@mdpe-ir Please have a look at this example to get the position of a story item storyexample/lib/whatsapp.dart:151

You can also use custom keys to have handles on story positions... Please have a look at this PR:#74 which talks about that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants