Get rid of that stinky ass weird ass grid sliver
This commit is contained in:
@@ -80,42 +80,43 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: _refreshGames,
|
||||
child: GridView.builder(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(8),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
childAspectRatio: 1.3,
|
||||
crossAxisSpacing: 4,
|
||||
mainAxisSpacing: 4,
|
||||
child: Wrap(
|
||||
spacing: 4,
|
||||
runSpacing: 4,
|
||||
children: [
|
||||
...games.map((game) => SizedBox(
|
||||
width: 400,
|
||||
child: GameCard(
|
||||
game: game,
|
||||
onGameUpdated: (game) async {
|
||||
game = await GameRepository.upsert(game);
|
||||
setState(() {
|
||||
games[games.indexOf(game)] = game;
|
||||
});
|
||||
},
|
||||
onDelete: () async {
|
||||
await GameRepository.delete(game);
|
||||
setState(() {
|
||||
games.remove(game);
|
||||
});
|
||||
},
|
||||
),
|
||||
itemCount: games.length + 1, // +1 for the new game card
|
||||
itemBuilder: (context, index) {
|
||||
if (index == games.length) {
|
||||
return NewGameCard(
|
||||
)),
|
||||
SizedBox(
|
||||
width: 400,
|
||||
child: NewGameCard(
|
||||
onGameCreated: (game) async {
|
||||
game = await GameRepository.upsert(game);
|
||||
setState(() {
|
||||
games.add(game);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
return GameCard(
|
||||
game: games[index],
|
||||
onGameUpdated: (game) async {
|
||||
game = await GameRepository.upsert(game);
|
||||
setState(() {
|
||||
games[index] = game;
|
||||
});
|
||||
},
|
||||
onDelete: () async {
|
||||
await GameRepository.delete(games[index]);
|
||||
setState(() {
|
||||
games.removeAt(index);
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user