GameHistoryView anpassen #20
@@ -1,11 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/data/db/database.dart';
|
import 'package:game_tracker/data/db/database.dart';
|
||||||
import 'package:game_tracker/data/dto/game.dart';
|
import 'package:game_tracker/data/dto/game.dart';
|
||||||
import 'package:game_tracker/data/dto/group.dart';
|
import 'package:game_tracker/data/dto/group.dart';
|
||||||
import 'package:game_tracker/data/dto/player.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/widgets/tiles/game_history_tile.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/top_centered_message.dart';
|
import 'package:game_tracker/presentation/widgets/top_centered_message.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/app_skeleton.dart'; // Add this import
|
import 'package:game_tracker/presentation/widgets/app_skeleton.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/buttons/custom_width_button.dart';
|
||||||
|
gelbeinhalb marked this conversation as resolved
Outdated
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class GameHistoryView extends StatefulWidget {
|
class GameHistoryView extends StatefulWidget {
|
||||||
@@ -57,51 +60,79 @@ class _GameHistoryViewState extends State<GameHistoryView> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
gelbeinhalb marked this conversation as resolved
Outdated
sneeex
commented
Errormessage anders, handelt sich ja nicht um recent games Errormessage anders, handelt sich ja nicht um recent games
gelbeinhalb
commented
jo jo
sneeex
commented
und besser standartisierte und besser standartisierte `top_centered_message` wie in GroupsView benutzen.
Außerdem sieht das Alignement komisch aus:

gelbeinhalb
commented
hab das 1zu1 von felix kopiert hab das 1zu1 von felix kopiert
flixcoo
commented
Ja das war ein schwerer Fehler, würde nichtmal von mir selbst kopieren Ja das war ein schwerer Fehler, würde nichtmal von mir selbst kopieren
|
|||||||
return FutureBuilder<List<Game>>(
|
return Scaffold(
|
||||||
future: _gameListFuture,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
builder: (BuildContext context, AsyncSnapshot<List<Game>> snapshot) {
|
body: Stack(
|
||||||
if (snapshot.hasError) {
|
alignment: Alignment.center,
|
||||||
return const Center(
|
children: [
|
||||||
child: TopCenteredMessage(
|
FutureBuilder<List<Game>>(
|
||||||
icon: Icons.report,
|
future: _gameListFuture,
|
||||||
title: 'Error',
|
builder: (BuildContext context, AsyncSnapshot<List<Game>> snapshot) {
|
||||||
|
gelbeinhalb marked this conversation as resolved
Outdated
sneeex
commented
Errormessage anders, handelt sich ja nicht um recent games Errormessage anders, handelt sich ja nicht um recent games
gelbeinhalb
commented
jo jo
sneeex
commented
und besser standartisierte und besser standartisierte `top_centered_message` wie in GroupsView benutzen.
Außerdem sieht das Alignement komisch aus:

|
|||||||
message: 'Game data could not be loaded',
|
if (snapshot.hasError) {
|
||||||
),
|
return const Center(
|
||||||
);
|
child: TopCenteredMessage(
|
||||||
}
|
icon: Icons.report,
|
||||||
|
gelbeinhalb marked this conversation as resolved
Outdated
flixcoo
commented
Die Skeleton-Zeit ist viel kürzer als bei allen anderen Screens. Ich glaube das liegt an dieser Zeile, weil du hier die Die Skeleton-Zeit ist viel kürzer als bei allen anderen Screens. Ich glaube das liegt an dieser Zeile, weil du hier die `isLoading` Variable setzt und nicht nach dem oben angegebenen 250ms delay.
gelbeinhalb
commented
okay danke :) guck ich mir an okay danke :) guck ich mir an
|
|||||||
if (snapshot.connectionState == ConnectionState.done &&
|
title: 'Error',
|
||||||
(!snapshot.hasData || snapshot.data!.isEmpty)) {
|
message: 'Game data could not be loaded',
|
||||||
return const Center(
|
),
|
||||||
child: TopCenteredMessage(
|
|
||||||
icon: Icons.report,
|
|
||||||
title: 'Error',
|
|
||||||
message: 'No Games Available',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<Game> games = (isLoading
|
|
||||||
? skeletonData
|
|
||||||
: (snapshot.data ?? [])
|
|
||||||
..sort((a, b) => b.createdAt.compareTo(a.createdAt)))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
return AppSkeleton(
|
|
||||||
enabled: isLoading,
|
|
||||||
child: ListView.builder(
|
|
||||||
padding: const EdgeInsets.only(bottom: 85),
|
|
||||||
itemCount: games.length + 1,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
if (index == games.length) {
|
|
||||||
return SizedBox(
|
|
||||||
height: MediaQuery.paddingOf(context).bottom - 80,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return GameHistoryTile(game: games[index]);
|
if (snapshot.connectionState == ConnectionState.done &&
|
||||||
|
(!snapshot.hasData || snapshot.data!.isEmpty)) {
|
||||||
|
return const Center(
|
||||||
|
child: TopCenteredMessage(
|
||||||
|
icon: Icons.report,
|
||||||
|
title: 'Error',
|
||||||
|
message: 'No Games Available',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
gelbeinhalb marked this conversation as resolved
Outdated
flixcoo
commented
Bitte das Custom Widget Bitte das Custom Widget `AppSkeleton` aus `development` hier noch Implementieren
|
|||||||
|
|
||||||
|
final List<Game> games = (isLoading
|
||||||
|
? skeletonData
|
||||||
|
: (snapshot.data ?? [])
|
||||||
|
..sort((a, b) => b.createdAt.compareTo(a.createdAt)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return AppSkeleton(
|
||||||
|
enabled: isLoading,
|
||||||
|
child: ListView.builder(
|
||||||
|
padding: const EdgeInsets.only(bottom: 85),
|
||||||
|
itemCount: games.length + 1,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
gelbeinhalb marked this conversation as resolved
Outdated
sneeex
commented
padding zu groß, zu viel platz unten ohne button, mit button evtl passend padding zu groß, zu viel platz unten ohne button, mit button evtl passend
|
|||||||
|
if (index == games.length) {
|
||||||
|
return SizedBox(
|
||||||
|
height: MediaQuery.paddingOf(context).bottom - 80,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return GameHistoryTile(game: games[index]); // Placeholder
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
gelbeinhalb marked this conversation as resolved
flixcoo
commented
Es fehlt noch der Create Game Button Es fehlt noch der Create Game Button
gelbeinhalb
commented
Der um ein Match zu erstellen? oder der um ein Game zu erstellen? Der um ein Match zu erstellen? oder der um ein Game zu erstellen?
flixcoo
commented
Digga xD der Button der zur Digga xD der Button der zur `CreateGameView` führt
sneeex
commented
Bitte customwidthbutton mit breite 0,9 wie bei groupsview machen Bitte customwidthbutton mit breite 0,9 wie bei groupsview machen
|
|||||||
);
|
Positioned(
|
||||||
},
|
bottom: MediaQuery.paddingOf(context).bottom,
|
||||||
|
child: CustomWidthButton(
|
||||||
|
text: 'Create Game',
|
||||||
|
sizeRelativeToWidth: 0.90,
|
||||||
|
onPressed: () async {
|
||||||
|
await Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) {
|
||||||
|
return const CreateGroupView();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
_gameListFuture = db.gameDao.getAllGames();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Umbennenung zu
GameViewstand mal im Raum oder?Ist nicht ein GameView das was sich öffnet wenn man auf ein Game klickt?
@mathiskir hat die jetzt
GameResultViewgenannt, aber quatsch ihr euch da sonst nochmal abIch finde wir sollten beides von
Game....ViewinMatch...Viewumbenennen.Game = Das Spiel (Brettspiel, Kartenspiel)
Match = Eine Partie des Spiels
@flixcoo @mathiskir
Ja fand ich glaub ich sinnvoll. Dann müssten wir aber auch die entsprechenden Klassen umbenennen. Ich würde vorschlagen dass gesammelt in einem Ticket zu machen und deins so zu mergen
Ja würde ich auch sagen, weil dann ja sogar die Datenbank implementation geändert werden muss noch. Und auch unsere test json
ja, lass das hier erstmal rauslassen