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

Support custom ExpansionPanel icon #108973

Open
masus04 opened this issue Aug 4, 2022 · 14 comments
Open

Support custom ExpansionPanel icon #108973

masus04 opened this issue Aug 4, 2022 · 14 comments
Assignees
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list team-design Owned by Design Languages team triaged-design Triaged by Design Languages team

Comments

@masus04
Copy link

masus04 commented Aug 4, 2022

Use case

ExpansionPanel should allow the user to customize or even remove the trailing expansion icon/button. This is even more needed as the canTapOnHeader key allows expanding elements by clicking on the header instead of the icon.

ExpansionPanelList in combination with ExpansionPanels are currently the only canonical option to build a list of expandable tiles. Out of the two, only ExpansionPanel can be expanded and collapsed programmatically, and therefore only ExpansionPanel is able to enforce that only one element is expanded at any given time, collapsing any other element when a new one is expanded. However, while ExpansionTile does not force the expansion icon, ExpansionPanel does.

It seems like quite a common use case to want a List of expandable elements but not show a fixed style expand button, either because the button should be customizable or be replaced with a clickable heading.

Proposal

Add the following keys to ExpansionPanel:

enum ExpandIconPosition {left, right};
enum CollapseIconPosition {left, right};

ExpansionPanel({
  Icon? expandIcon = DefaultExpandIcon(),
  Icon? collapseIcon = DefaultCollapseIcon(),
  ExpandIconPosition expandIconPosition = ExpandIconPosition.right,
  CollapseIconPosition collapseIconPosition = CollapseIconPosition.right,
...
})

The expand/collapse icons should replace the currently hardcoded arrow icons or in case they are null, not display any expand/collapse buttons.

The ExpandIconPosition and CollapseIconPosition should control where the expand/collapse button is located.

@danagbemava-nc danagbemava-nc added in triage Presently being triaged by the triage team c: new feature Nothing broken; request for a new capability framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. c: proposal A detailed proposal for a change to Flutter and removed in triage Presently being triaged by the triage team labels Aug 5, 2022
@oravecz
Copy link

oravecz commented Sep 21, 2022

If this is worked on, I would like to also be able to adjust the positioning of the icon in the Row. Currently, it is centered in the row, and I would like an option to adjust that alignment to the start (e.g. top). My header, when expanded has several lines of descriptive text in the header, and if the icon is centered vertically, I think it looks awkward. Ideally, allowing for a leading/trailing widget to be passed in, and this widget expands to the height of the header should give us complete control over the icons and their alignment.

@ramirezsebas
Copy link

Hey @masus04 , I might try to add this feature, I think separating the collapsed icon and expanded icon is not necesary, it uses an icon and rotates the icon with a Tween.
What do you think about just passing an icon and the degree of the rotation?

@saurabhkumar8112
Copy link

saurabhkumar8112 commented May 11, 2023

Giving support to change the icon tile height is also fairly important. Right now it's too rigid

@iska9der
Copy link

Please, give us ability to remove that icon.
For example, this is how it look in my app:

image

What if i want to make this icon with the same background as in my header?
I can add my own icon to the header, but its required to remove icon from ExpansionPanelList.
Boolean hasIcon argument may be helpful for achieve this

@iska9der
Copy link

iska9der commented Jun 17, 2023

For now, you can check this answer on stackoverflow for a temporary solution

image

@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-design Owned by Design Languages team triaged-design Triaged by Design Languages team labels Jul 8, 2023
@Macacoazul01
Copy link
Contributor

Macacoazul01 commented Jul 12, 2023

@danagbemava-nc there is this closed PR that tried to implement the function years ago:
#62383

Any chances of this being merged?

@Macacoazul01
Copy link
Contributor

this issue is also a duplicate of #32802

@Macacoazul01
Copy link
Contributor

There is also another PR that tried to create this: #35416

@stuartmorgan
Copy link
Contributor

@danagbemava-nc there is this closed PR that tried to implement the function years ago: #62383

Any chances of this being merged?

It was closed because it wasn't completed, as it says in the comments there; there is no chance of a PR that's neither complete nor reviewed being merged. Anyone interested in making a new, complete PR is certainly welcome to do so.

@Macacoazul01
Copy link
Contributor

found this one #121957

@Macacoazul01
Copy link
Contributor

@stuartmorgan any chances of helping me with the failing tests on this one?
The error logs are very unclear
#130462

@ronytesler
Copy link

also control the width of the content part vs the part where the icon is.

@flutter-triage-bot
Copy link

This issue is missing a priority label. Please set a priority label when adding the triaged-design label.

@flutter-triage-bot flutter-triage-bot bot removed the triaged-design Triaged by Design Languages team label Dec 13, 2023
@HansMuller HansMuller added the P2 Important issues not at the top of the work list label Jan 10, 2024
@HansMuller HansMuller added the triaged-design Triaged by Design Languages team label Jan 10, 2024
@HansMuller
Copy link
Contributor

This issue is being addressed by #130462

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list team-design Owned by Design Languages team triaged-design Triaged by Design Languages team
Projects
None yet
Development

No branches or pull requests