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

[Assistance] elements inside card not clickable #1

Open
Shubxam opened this issue Feb 7, 2020 · 1 comment
Open

[Assistance] elements inside card not clickable #1

Shubxam opened this issue Feb 7, 2020 · 1 comment

Comments

@Shubxam
Copy link

Shubxam commented Feb 7, 2020

I tried placing stateful elements inside _itemBuilder widget, but I couldn't get them to work. E.g how do you place a button inside the widget and make it clickable

@masa8
Copy link

masa8 commented Aug 3, 2021

One of the easiest ways to get what you want is to fork and change the widget returned by the build method of _StackCardState class to the following:

    return Stack(fit: StackFit.expand, children: <Widget>[
      PageView.builder(
        onPageChanged: widget.onSwap,
        physics: BouncingScrollPhysics(),
        controller: _pageController,
        itemCount: widget.itemCount,
        itemBuilder: (context, index) {
          return Container();
        },
      ),_cardStack(),
      widget.displayIndicator ? _cardIndicator() : Container(),

However, while this method is easy, it has the disadvantage that you will not be able to swipe on the card.

Currently, the transparent container created by PageView class is placed on top of your button.
Therefore, the button on your card will not work.

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