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

CardSwiper doesn't work inside of ListView #101

Open
nausharipov opened this issue Apr 30, 2024 · 0 comments
Open

CardSwiper doesn't work inside of ListView #101

nausharipov opened this issue Apr 30, 2024 · 0 comments

Comments

@nausharipov
Copy link

CardSwiper doesn't work inside of ListView:

void main() {
  runApp(
    const MaterialApp(
      home: CardSwiperInsideListView(),
    ),
  );
}

class CardSwiperInsideListView extends StatelessWidget {
  const CardSwiperInsideListView({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // works if ListView is replaced with Column
      body: ListView(
        children: [
          SizedBox(
            height: 200,
            child: CardSwiper(
              cardsCount: 2,
              allowedSwipeDirection: const AllowedSwipeDirection.symmetric(
                vertical: true,
              ),
              cardBuilder: (
                context,
                index,
                horizontalOffsetPercentage,
                verticalOffsetPercentage,
              ) =>
                  Container(
                width: 200,
                height: 100,
                color: index > 0 ? Colors.red[300] : Colors.blue[300],
              ),
            ),
          ),
        ],
      ),
    );
  }
}

Video:
https://github.com/TheAnkurPanchani/card_swiper/assets/31556582/f4855d26-b1aa-4e27-bfcb-f69be53c53a2

Expected behavior: vertical swipes work inside of a vertical scroll.

flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.1, on macOS 14.3.1 23D60 darwin-x64, locale en-KZ)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.87.0)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!
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

1 participant