简体   繁体   中英

How to reduce Flutter expansionTile height

I want to reduce the height of an expansionTile,

I have tried ConfigurableExpansionTile but it doesn't support null safety so I can't use it in my project.

I have also wrapped my ExpansionTile in ListTileTheme as such:

return ListTileTheme(
      dense: true,
      child: ExpansionTile(

It reduce the height but still not enough for me.

Thanks for helping if you have a solution.

I dont know about ExpansionTile but you can use ExpandablePanel , which can serve your purpose and you can easily custom the heights of the widgets. Also it supports null-safety.

ExpandablePanel(
theme: const ExpandableThemeData(
headerAlignment:
    ExpandablePanelHeaderAlignment.center,
//tapBodyToExpand: true,
//tapBodyToCollapse: true,
hasIcon: false,
),
header: Expandable(
collapsed: buildCollapsed(), // widget header when the widget is 
Collapsed
   expanded: buildExpanded(), // header when the widget is Expanded
),
 collapsed: Container(), // body when the widget is Collapsed, I didnt 
    need anything here. 
 expanded:  expandedColumn() // body when the widget is Expanded
 ) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM