|
|
|
|
@@ -5,12 +5,10 @@ import 'package:game_tracker/data/dto/game.dart';
|
|
|
|
|
import 'package:game_tracker/data/dto/group.dart';
|
|
|
|
|
import 'package:game_tracker/data/dto/player.dart';
|
|
|
|
|
import 'package:game_tracker/presentation/views/main_menu/create_group_view.dart';
|
|
|
|
|
import 'package:game_tracker/presentation/widgets/tiles/game_history_tile.dart';
|
|
|
|
|
import 'package:game_tracker/presentation/views/main_menu/create_game/create_game_view.dart';
|
|
|
|
|
import 'package:game_tracker/presentation/widgets/buttons/custom_width_button.dart';
|
|
|
|
|
import 'package:game_tracker/presentation/widgets/top_centered_message.dart';
|
|
|
|
|
import 'package:game_tracker/presentation/widgets/app_skeleton.dart';
|
|
|
|
|
import 'package:game_tracker/presentation/widgets/buttons/custom_width_button.dart';
|
|
|
|
|
import 'package:game_tracker/presentation/widgets/tiles/game_history_tile.dart';
|
|
|
|
|
import 'package:game_tracker/presentation/widgets/top_centered_message.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class GameHistoryView extends StatefulWidget {
|
|
|
|
|
@@ -40,9 +38,7 @@ class _GameHistoryViewState extends State<GameHistoryView> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
winner: Player(name: 'Skeleton Player 1'),
|
|
|
|
|
players: [
|
|
|
|
|
Player(name: 'Skeleton Player 6')
|
|
|
|
|
],
|
|
|
|
|
players: [Player(name: 'Skeleton Player 6')],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@@ -69,7 +65,8 @@ class _GameHistoryViewState extends State<GameHistoryView> {
|
|
|
|
|
children: [
|
|
|
|
|
FutureBuilder<List<Game>>(
|
|
|
|
|
future: _gameListFuture,
|
|
|
|
|
builder: (BuildContext context, AsyncSnapshot<List<Game>> snapshot) {
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context, AsyncSnapshot<List<Game>> snapshot) {
|
|
|
|
|
if (snapshot.hasError) {
|
|
|
|
|
return const Center(
|
|
|
|
|
child: TopCenteredMessage(
|
|
|
|
|
@@ -90,10 +87,11 @@ class _GameHistoryViewState extends State<GameHistoryView> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final List<Game> games = (isLoading
|
|
|
|
|
? skeletonData
|
|
|
|
|
: (snapshot.data ?? [])
|
|
|
|
|
..sort((a, b) => b.createdAt.compareTo(a.createdAt)))
|
|
|
|
|
final List<Game> games =
|
|
|
|
|
(isLoading ? skeletonData : (snapshot.data ?? [])
|
|
|
|
|
..sort(
|
|
|
|
|
(a, b) => b.createdAt.compareTo(a.createdAt),
|
|
|
|
|
))
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
return AppSkeleton(
|
|
|
|
|
@@ -107,7 +105,9 @@ class _GameHistoryViewState extends State<GameHistoryView> {
|
|
|
|
|
height: MediaQuery.paddingOf(context).bottom - 80,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return GameHistoryTile(game: games[index]); // Placeholder
|
|
|
|
|
return GameHistoryTile(
|
|
|
|
|
game: games[index],
|
|
|
|
|
); // Placeholder
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|