Bearbeiten und Löschen von Matches #171
@@ -58,7 +58,7 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
db = Provider.of<AppDatabase>(context, listen: false);
|
db = Provider.of<AppDatabase>(context, listen: false);
|
||||||
loadGames();
|
loadMatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -100,7 +100,7 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
adaptivePageRoute(
|
adaptivePageRoute(
|
||||||
builder: (context) => MatchDetailView(
|
builder: (context) => MatchDetailView(
|
||||||
match: matches[index],
|
match: matches[index],
|
||||||
onMatchUpdate: loadGames,
|
onMatchUpdate: loadMatches,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -123,7 +123,7 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
context,
|
context,
|
||||||
adaptivePageRoute(
|
adaptivePageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
CreateMatchView(onWinnerChanged: loadGames),
|
CreateMatchView(onWinnerChanged: loadMatches),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -134,8 +134,8 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads the games from the database and sorts them by creation date.
|
/// Loads the matches from the database and sorts them by creation date.
|
||||||
void loadGames() {
|
void loadMatches() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
Future.wait([
|
Future.wait([
|
||||||
db.matchDao.getAllMatches(),
|
db.matchDao.getAllMatches(),
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final match = widget.match;
|
final match = widget.match;
|
||||||
final group = widget.match.group;
|
final group = match.group;
|
||||||
final winner = widget.match.winner;
|
final winner = match.winner;
|
||||||
final players = [...widget.match.players]
|
final players = [...match.players]
|
||||||
..sort((a, b) => a.name.compareTo(b.name));
|
..sort((a, b) => a.name.compareTo(b.name));
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user