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

Confilct with carousel_slider #24

Open
Donk3ys opened this issue Jan 11, 2022 · 1 comment
Open

Confilct with carousel_slider #24

Donk3ys opened this issue Jan 11, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Donk3ys
Copy link

Donk3ys commented Jan 11, 2022

Describe the bug
When sliding through a carousel from the carousel_slider package the loadMore function gets called from paginable.

Not sure how the two are conflicting or if there is a work around.

To Reproduce

class TestError extends StatelessWidget {
  final List<List<Color>> itemList = [
    [Colors.black87, Colors.black54],
    [Colors.white38, Colors.white54],
    [Colors.red, Colors.redAccent],
    [Colors.blue, Colors.blueAccent],
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PaginableCustomScrollView(
        loadMore: () async => print("CALLED LOAD MORE"),  //  THIS SHOULD NOT GET CALLED WHEN SCROLLING CAROUSEL
        slivers: [
          SliverList(
            delegate: PaginableSliverChildBuilderDelegate(
              (context, index) {
                final item = itemList.elementAt(index);
                return CarouselSlider(
                  options: CarouselOptions(
                    height: MediaQuery.of(context).size.height * 0.5,
                    enableInfiniteScroll: false,
                  ),
                  items: item
                      .map(
                        (clr) => Container(
                          color: clr,
                          child: const Center(child: Text("< Swipe >")),
                        ),
                      )
                      .toList(),
                );
              },
              childCount: itemList.length,
              errorIndicatorWidget: (exception, tryAgain) =>
                  PaginationErrorWifdget(
                exception: exception,
                tryAgain: tryAgain,
              ),
              progressIndicatorWidget: const PaginationLoadingWidget(),
            ).build(),
          ),
        ],
      ),
    );
  }
}

Run code above and read console output

Additional context
Not sure if this even affects your package but just though id let you know in case you have an easy workaround.

@Donk3ys Donk3ys added the bug Something isn't working label Jan 11, 2022
@Donk3ys
Copy link
Author

Donk3ys commented Jan 14, 2022

I did a bit of testing and it seams the carousel package triggers the ScrollUpdateNotification.

if I add a check for scrollUpdateNotification.dragDetails?.delta != null before performPagination() the error seems to be fixed... its a bit of a hacky solution unfortunately but does the job for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants