Home > Software engineering >  How to reduce Flutter expansionTile height
How to reduce Flutter expansionTile height

Time:01-14

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.

CodePudding user response:

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
 ) 
  •  Tags:  
  • Related