Robouste
Robouste

Reputation: 3680

Flutter - Expansion Panel Header - Whole header clickable

I've build a list of expansion panel and I find it annoying that you have to press the arrow to expand it. Intuitively, you want to expand the panel when you click anywhere on the header (feedback from testers).

Is there a way to do it ? I don't see any properties and the header builder only allows a widget as parameter.

Upvotes: 5

Views: 1442

Answers (1)

ibhavikmakwana
ibhavikmakwana

Reputation: 10101

If you are using the ExpansionPanelRadio then it has a parameter called canTapOnHeader, make it to true.

Like below:

ExpansionPanelRadio(
  value: item.id,
  canTapOnHeader: true,
  headerBuilder: (BuildContext context, bool isExpanded) {
    ...
  },
  body: ...,
);

Upvotes: 6

Related Questions