Giter Club home page Giter Club logo

Comments (8)

bambinoua avatar bambinoua commented on August 23, 2024 8

I confirmed tapBodyToCollapse and tapBodyToExpand don't work. ExpandableThemeData is created globally and used for all Expandables:

ExpandableThemeData get expandableTheme => ExpandableThemeData(
  tapBodyToCollapse: true,
  tapBodyToExpand: true,
);

Expandable(
  theme: expandableTheme,
  header: ...,
  collapsed: ...
  expanded:...
),

from flutter-expandable.

nelsyeung avatar nelsyeung commented on August 23, 2024 6

@cmorsucci
I believe you need to wrap expandables with ExpandableNotifier to allow this to work. Just having ExpandablePanel won't work with tapBodyToExpand.

For example (tested on 4.1.4):

  Widget build(BuildContext context) {
    return ExpandableNotifier(
      child: ExpandablePanel(
        theme: const ExpandableThemeData(
          tapBodyToExpand: true,
          tapBodyToCollapse: true,
        ),
        collapsed: Text(
          loremIpsum,
          softWrap: true,
          maxLines: 2,
          overflow: TextOverflow.ellipsis,
        ),
        expanded: Text(loremIpsum, softWrap: true),
      ),
    );
  }

from flutter-expandable.

aryzhov avatar aryzhov commented on August 23, 2024 3

The workaround would be to wrap your collapsed body with ExpandableButton. I am still not sure why this doesn't work for some people. Would anybody please provide a minimal example: not just a fragment, a complete widget that demonstrates the issue?

from flutter-expandable.

aryzhov avatar aryzhov commented on August 23, 2024

I could not reproduce this problem. The demo has a card with tapBodyToCollapse: true and it works just fine. I suggest you make a minimally reproducible example.

from flutter-expandable.

goashwin avatar goashwin commented on August 23, 2024

I'm on 4.1.3, tapBodyToExpand doesn't work. Regular header behavior works.

from flutter-expandable.

goashwin avatar goashwin commented on August 23, 2024

Anybody know a workaround or temp fix I can use?

from flutter-expandable.

alexgrant999 avatar alexgrant999 commented on August 23, 2024

The hasIcon and tapHeaderToExpand both have lines through them and the tooltip tells me that they are depreciated. For sure, does not work.

from flutter-expandable.

cmorsucci avatar cmorsucci commented on August 23, 2024

Same issue, this is my widget @aryzhov :

class PromoTableViewCell extends StatelessWidget {
  final bool showShareButton;
  final bool showEditButton;
  final bool showPublishButton;

  PromoTableViewCell({
    Key key,
    this.showShareButton = false,
    this.showEditButton = false,
    this.showPublishButton = false,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
        padding: const EdgeInsets.only(top: 20.0),
        child: Column(
          children: [
            Row(
              children: [
                Expanded(
                  child: Container(
                    padding: const EdgeInsets.only(left: 16.0, right: 16, top: 10),
                    child: ExpandablePanel(
                      theme: ExpandableThemeData(
                        headerAlignment: ExpandablePanelHeaderAlignment.center,
                        iconColor: MyColors.black,
                        tapBodyToCollapse: true,
                        tapBodyToExpand: true,
                        hasIcon: false,
                      ),
                      header: Container(
                        //color: Colors.pink,
                        child: null,
                      ),
                      collapsed: Text(
                        'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
                        style: TextStyle(color: MyColors.black),
                        softWrap: true,
                        maxLines: 1,
                        overflow: TextOverflow.ellipsis,
                      ),
                      expanded: Text(
                        'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
                        style: TextStyle(color: MyColors.black),
                        softWrap: true,
                      ),
                    ),
                  ),
                ),
              ],
            ),
          ],
        ));
  }
}

from flutter-expandable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.