我很沮丧。
我需要一个 Gridview.builder(或每行 3 列的 Listview) 并且在网格顶部我需要 1 个标题。
然而我的代码要么把 3 列列表搞砸了,要么把标题搞砸了,然后会变成三倍。
我是一个完全的编码新手。但我正在拼命解决这个问题。
请提前为错误的代码道歉。
GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,),
itemCount: 210,
itemBuilder: (context, index) {
return StickyHeader(
header: Container(
height: 50.0,
color: Colors.blueGrey[700],
padding: EdgeInsets.symmetric(horizontal: 16.0),
alignment: Alignment.centerLeft,
child: Text('Header',
style: const TextStyle(color: Colors.white),
),
),
content: Column(
children:
List<int>.generate(21, (index) => index)
.map((item) => Container(
decoration:
BoxDecoration( // <-- BoxDecoration
border: Border(bottom: BorderSide())
),
height: 50,
width: 5000000,
child: Text ('Test'),
))
.toList(),
),
);
}),