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

onPageChanged callback NOT working #56

Open
divyamdhz opened this issue Jan 24, 2024 · 1 comment
Open

onPageChanged callback NOT working #56

divyamdhz opened this issue Jan 24, 2024 · 1 comment

Comments

@divyamdhz
Copy link

I have this piece of code :

StoryPageView(
                itemBuilder: (context, pageIndex, storyIndex) {
                  // We can use NULL checks as if .data does NOT have any value OR
                  // If storyData is empty, such cases are handled before the code
                  // written below is executed
                  final hashMap = zoopShots.data!.storyData;
                  final hashMapList = hashMap!.values.toList();

                  var imageSrc = ApiUrls.strapiBaseUrl +
                      hashMapList[storyIndex].url.substring(1);

                  return Stack(
                    children: [
                      //  Background Color
                      Positioned.fill(
                        child: Container(
                          color: const Color(0xFFF2F6FF),
                        ),
                      ),
                      //  Main Image
                      renderContent(context, imageSrc),
                    ],
                  );
                },
                gestureItemBuilder: (context, pageIndex, storyIndex) {
                  return const SizedBox.shrink();
                },
                indicatorAnimationController: indicatorAnimationController,
                initialStoryIndex: (pageIndex) {
                  final index = widget.model?.indexToVisit ?? 0;
                  return index;
                },
                pageLength: 1,
                storyLength: (int pageIndex) {
                  return zoopShots.data!.storyData!.length;
                },
                onPageChanged: (index) {
                  log('Currently at $index');
                },
                onPageLimitReached: () => Navigator.pop(context),
              );

Doesn't matter I manually change the story OR it gets changed automatically after the timer runs out, this callback (onPageChanged ) never gets called/executed.

@divyamdhz divyamdhz changed the title onPagChanged callback NOT working onPageChanged callback NOT working Jan 24, 2024
@ayyysh04z
Copy link

@divyamdhz 'onPageChanged' callback is used when a complete page changes ,in your code you have used single page multiple slide view (pageLength = 1).

Currently there is no callback when a slide of particular page changes in this plugin ,although can make some adjustment to do so.

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

2 participants