单击时如何将 ExpansionTile 小部件重叠在其他小部件上?

How to overlap a ExpansionTile widget over other widget when clicked?

我有一个 ExpansionTile 小部件的 GridList,每个小部件都包裹在一个 Card 小部件上。

我的问题是当我单击任何 ExpansionTile 小部件时出现像素溢出错误。 如何解决?

//This is my main page
return Container(
  width: queryData.size.width*0.65,
  child: GridView.count(
    primary: false,
    padding: const EdgeInsets.all(20),
    crossAxisSpacing: 10,
    mainAxisSpacing: 10,
    crossAxisCount: 3,
    childAspectRatio: 3.5,
    children: <Widget>[
      Card(child: ShadyExpansionTile()),
      Card(child: ShadyExpansionTile()),
      Card(child: ShadyExpansionTile()),
      Card(child: ShadyExpansionTile()),
    ],
  ),
);

  //This is my custom ExpansionTile(Shady is my nick name)
    class ShadyExpansionTile extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ExpansionTile(
        title: Text('my title'),
        children: <Widget>[
          Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. '),
        ],
      );
  }
}

您为什么使用 gridview?你可以尝试换行吗?尝试添加 SingleShildScrollViewer 或创建堆栈。