我有一个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. '),
],
);
}
}
答案 0 :(得分:1)
为什么要使用gridview?您可以尝试换行吗?尝试添加SingleShildScrollViewer或创建堆栈。