Search code examples
flutterdivider

Children ExpansionTile Flutter


How can I remove the divider when I expand my ExpansionTile while setting Padding for it?

return Card(
      borderOnForeground: false,
      key: Key("${e.id}"),
      child: Padding(
        padding: EdgeInsets.only(bottom: 8.0),
        child: ExpansionTile(
          backgroundColor: Theme.of(context).accentColor,
          title: Text(
            e.title,
            style: Theme.of(context).textTheme.bodyText1,
            maxLines: 1,
          ),
          subtitle: Text(e.by),
          children: <Widget>[
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: <Widget>[ Text("${e.descendants} comments"),Icon(Icons.open_in_new)],)
          ],
        ),
      ),
    );

Here is my Screen shot enter image description here


Solution

  • Theme(
          data: Theme.of(context).copyWith(dividerColor: Colors.transparent),
          child: ExpansionTile(/*youdata*/));
    

    You can wrap the ExpansionTile with Theme like above to achieve this.