【问题标题】:Children ExpansionTile Flutter儿童 ExpansionTile Flutter
【发布时间】:2020-02-28 09:28:45
【问题描述】:

如何在展开我的 ExpansionTile 并为其设置 Padding 时移除分隔线?

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)],)
          ],
        ),
      ),
    );

这是我的屏幕截图 enter image description here

【问题讨论】:

  • 这个设备是ExpansionTile边界。您可以简单地复制并粘贴所有ExpansionTile Widget 并从中删除BorderSide(color: borderSideColor)

标签: flutter divider


【解决方案1】:
Theme(
      data: Theme.of(context).copyWith(dividerColor: Colors.transparent),
      child: ExpansionTile(/*youdata*/));

您可以像上面一样用 Theme 包装 ExpansionTile 来实现这一点。

【讨论】:

    猜你喜欢
    • 2019-10-23
    • 2018-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多