| | |
| | | ], |
| | | ), |
| | | ) |
| | | : GridView.builder( |
| | | : LayoutBuilder(builder: (context, constraints) { |
| | | // 卡片高度 = 封面高度 + 信息区实际内容高度,避免出现大段空白 |
| | | const crossAxisSpacing = 16.0; |
| | | final cardWidth = |
| | | (constraints.maxWidth - crossAxisSpacing * 3) / 4; |
| | | final coverHeight = cardWidth / 1.42; |
| | | const infoHeight = 96.0; |
| | | return GridView.builder( |
| | | padding: const EdgeInsets.only(bottom: 40), |
| | | gridDelegate: |
| | | const SliverGridDelegateWithFixedCrossAxisCount( |
| | | SliverGridDelegateWithFixedCrossAxisCount( |
| | | crossAxisCount: 4, |
| | | mainAxisSpacing: 18, |
| | | crossAxisSpacing: 16, |
| | | childAspectRatio: 0.62, |
| | | crossAxisSpacing: crossAxisSpacing, |
| | | mainAxisExtent: coverHeight + infoHeight, |
| | | ), |
| | | itemCount: games.length, |
| | | itemBuilder: (context, i) => GameCard(game: games[i]), |
| | | ), |
| | | ); |
| | | }), |
| | | ), |
| | | ], |
| | | ), |