flutter

How to remove the divider lines of an ExpansionTile when expanded in Flutter


I have an ExpansionTile within my Drawer widget. When I expand this item, it automatically adds a divider line above and below. I want these divider lines permanently.

So I'd either like to know how to show the ExpansionTile's divider lines always (expanded and unexpanded), or I can add my own divider lines and tell the ExpansionTile to never show divider lines.

Is this possible? Thanks.


Solution

  • you can hide divider lines by wrapping the ExpansionTile widget in Theme Widget,

    your code will look like this after you add Theme widget

    Theme(
         data: Theme.of(context).copyWith(dividerColor: Colors.transparent),
         child:ExpansionTile(
             title:...,
             children:[],
         ),
    ),
    

    check this Github Issue