add: empty game list messages
This commit is contained in:
@@ -80,6 +80,7 @@
|
||||
"members": "Mitglieder",
|
||||
"most_points": "Höchste Punkte",
|
||||
"no_data_available": "Keine Daten verfügbar",
|
||||
"no_games_created_yet": "Noch keine Spielvorlagen erstellt",
|
||||
"no_groups_created_yet": "Noch keine Gruppen erstellt",
|
||||
"no_licenses_found": "Keine Lizenzen gefunden",
|
||||
"no_license_text_available": "Kein Lizenztext verfügbar",
|
||||
@@ -125,6 +126,7 @@
|
||||
"statistics": "Statistiken",
|
||||
"stats": "Statistiken",
|
||||
"successfully_added_player": "Spieler:in {playerName} erfolgreich hinzugefügt",
|
||||
"there_are_no_games_matching_your_search": "Es gibt keine Spielvorlagen, die deiner Suche entspricht",
|
||||
"there_is_no_group_matching_your_search": "Es gibt keine Gruppe, die deiner Suche entspricht",
|
||||
"this_cannot_be_undone": "Dies kann nicht rückgängig gemacht werden.",
|
||||
"tie": "Unentschieden",
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
"members": "Members",
|
||||
"most_points": "Most Points",
|
||||
"no_data_available": "No data available",
|
||||
"no_games_created_yet": "No games created yet",
|
||||
"no_groups_created_yet": "No groups created yet",
|
||||
"no_licenses_found": "No licenses found",
|
||||
"no_license_text_available": "No license text available",
|
||||
@@ -134,6 +135,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"there_are_no_games_matching_your_search": "There are no games matching your search",
|
||||
"there_is_no_group_matching_your_search": "There is no group matching your search",
|
||||
"this_cannot_be_undone": "This can't be undone.",
|
||||
"tie": "Tie",
|
||||
|
||||
@@ -536,6 +536,12 @@ abstract class AppLocalizations {
|
||||
/// **'No data available'**
|
||||
String get no_data_available;
|
||||
|
||||
/// No description provided for @no_games_created_yet.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'No games created yet'**
|
||||
String get no_games_created_yet;
|
||||
|
||||
/// No description provided for @no_groups_created_yet.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
@@ -800,6 +806,12 @@ abstract class AppLocalizations {
|
||||
/// **'Successfully added player {playerName}'**
|
||||
String successfully_added_player(String playerName);
|
||||
|
||||
/// No description provided for @there_are_no_games_matching_your_search.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'There are no games matching your search'**
|
||||
String get there_are_no_games_matching_your_search;
|
||||
|
||||
/// No description provided for @there_is_no_group_matching_your_search.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@@ -243,6 +243,9 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
@override
|
||||
String get no_data_available => 'Keine Daten verfügbar';
|
||||
|
||||
@override
|
||||
String get no_games_created_yet => 'Noch keine Spielvorlagen erstellt';
|
||||
|
||||
@override
|
||||
String get no_groups_created_yet => 'Noch keine Gruppen erstellt';
|
||||
|
||||
@@ -382,6 +385,10 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
return 'Spieler:in $playerName erfolgreich hinzugefügt';
|
||||
}
|
||||
|
||||
@override
|
||||
String get there_are_no_games_matching_your_search =>
|
||||
'Es gibt keine Spielvorlagen, die deiner Suche entspricht';
|
||||
|
||||
@override
|
||||
String get there_is_no_group_matching_your_search =>
|
||||
'Es gibt keine Gruppe, die deiner Suche entspricht';
|
||||
|
||||
@@ -243,6 +243,9 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get no_data_available => 'No data available';
|
||||
|
||||
@override
|
||||
String get no_games_created_yet => 'No games created yet';
|
||||
|
||||
@override
|
||||
String get no_groups_created_yet => 'No groups created yet';
|
||||
|
||||
@@ -382,6 +385,10 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
return 'Successfully added player $playerName';
|
||||
}
|
||||
|
||||
@override
|
||||
String get there_are_no_games_matching_your_search =>
|
||||
'There are no games matching your search';
|
||||
|
||||
@override
|
||||
String get there_is_no_group_matching_your_search =>
|
||||
'There is no group matching your search';
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:tallee/l10n/generated/app_localizations.dart';
|
||||
import 'package:tallee/presentation/views/main_menu/match_view/create_match/create_game_view.dart';
|
||||
import 'package:tallee/presentation/widgets/text_input/custom_search_bar.dart';
|
||||
import 'package:tallee/presentation/widgets/tiles/game_tile.dart';
|
||||
import 'package:tallee/presentation/widgets/top_centered_message.dart';
|
||||
|
||||
class ChooseGameView extends StatefulWidget {
|
||||
/// A view that allows the user to choose a game from a list of available games
|
||||
@@ -134,65 +135,86 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
||||
|
||||
// Game list
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: filteredGames.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final game = filteredGames[index];
|
||||
return GameTile(
|
||||
title: game.name,
|
||||
description: game.description,
|
||||
badgeText: translateRulesetToString(game.ruleset, context),
|
||||
badgeColor: getColorFromGameColor(game.color),
|
||||
isHighlighted: selectedGameId == game.id,
|
||||
onTap: () async {
|
||||
setState(() {
|
||||
if (selectedGameId == game.id) {
|
||||
selectedGameId = '';
|
||||
} else {
|
||||
selectedGameId = game.id;
|
||||
}
|
||||
});
|
||||
},
|
||||
onLongPress: () async {
|
||||
final result = await Navigator.push(
|
||||
child: Visibility(
|
||||
visible: filteredGames.isNotEmpty,
|
||||
replacement: Visibility(
|
||||
visible: widget.games.isNotEmpty,
|
||||
replacement: TopCenteredMessage(
|
||||
icon: Icons.info,
|
||||
title: loc.info,
|
||||
message: loc.no_games_created_yet,
|
||||
),
|
||||
child: TopCenteredMessage(
|
||||
icon: Icons.info,
|
||||
title: loc.info,
|
||||
message: AppLocalizations.of(
|
||||
context,
|
||||
).there_are_no_games_matching_your_search,
|
||||
),
|
||||
),
|
||||
child: ListView.builder(
|
||||
itemCount: filteredGames.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final game = filteredGames[index];
|
||||
return GameTile(
|
||||
title: game.name,
|
||||
description: game.description,
|
||||
badgeText: translateRulesetToString(
|
||||
game.ruleset,
|
||||
context,
|
||||
adaptivePageRoute(
|
||||
builder: (context) => CreateGameView(
|
||||
gameToEdit: game,
|
||||
matchCount: getMatchCount(game),
|
||||
onGameChanged: () {
|
||||
widget.onGamesUpdated?.call();
|
||||
},
|
||||
),
|
||||
badgeColor: getColorFromGameColor(game.color),
|
||||
isHighlighted: selectedGameId == game.id,
|
||||
onTap: () async {
|
||||
setState(() {
|
||||
if (selectedGameId == game.id) {
|
||||
selectedGameId = '';
|
||||
} else {
|
||||
selectedGameId = game.id;
|
||||
}
|
||||
});
|
||||
},
|
||||
onLongPress: () async {
|
||||
final result = await Navigator.push(
|
||||
context,
|
||||
adaptivePageRoute(
|
||||
builder: (context) => CreateGameView(
|
||||
gameToEdit: game,
|
||||
matchCount: getMatchCount(game),
|
||||
onGameChanged: () {
|
||||
widget.onGamesUpdated?.call();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (result != null && result.game != null) {
|
||||
// Find the index in the original list to mutate
|
||||
final originalIndex = widget.games.indexWhere(
|
||||
(g) => g.id == game.id,
|
||||
);
|
||||
if (originalIndex == -1) {
|
||||
return;
|
||||
if (result != null && result.game != null) {
|
||||
// Find the index in the original list to mutate
|
||||
final originalIndex = widget.games.indexWhere(
|
||||
(g) => g.id == game.id,
|
||||
);
|
||||
if (originalIndex == -1) {
|
||||
return;
|
||||
}
|
||||
if (result.delete) {
|
||||
setState(() {
|
||||
// deselect the game
|
||||
if (selectedGameId == game.id) {
|
||||
selectedGameId = '';
|
||||
}
|
||||
widget.games.removeAt(originalIndex);
|
||||
widget.onGamesUpdated?.call();
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
widget.games[originalIndex] = result.game;
|
||||
});
|
||||
}
|
||||
_refreshFromSource();
|
||||
}
|
||||
if (result.delete) {
|
||||
setState(() {
|
||||
// deselect the game
|
||||
if (selectedGameId == game.id) {
|
||||
selectedGameId = '';
|
||||
}
|
||||
widget.games.removeAt(originalIndex);
|
||||
widget.onGamesUpdated?.call();
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
widget.games[originalIndex] = result.game;
|
||||
});
|
||||
}
|
||||
_refreshFromSource();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user