diff --git a/board_games_companion/lib/common/app_text.dart b/board_games_companion/lib/common/app_text.dart index 62771544..da91f509 100644 --- a/board_games_companion/lib/common/app_text.dart +++ b/board_games_companion/lib/common/app_text.dart @@ -120,13 +120,15 @@ class AppText { static const gamesPageSearchNoSearchResults = '''It looks there's no games in your collections that match the search phrase '''; static const gamesPageSearchClearSaerch = 'Clear search'; - static const gamesPageSearchResultPlayersNumberGameStatFormat = '%i - %i players'; static const gamesPageSearchResultComplexityGameStatFormat = '%s (complexity rating)'; static const gamesPageSearchResultRefreshDetails = 'Games imported from the BGG collections are missing some details (e.g. complexity or expansions). Refresh the data to get the latest information.'; static const gamesPageSearchResultExpansionsSectionTitleFormat = 'Expansions (%i)'; - static const gamePlaytimeStatFormat = '%s min'; + static const gamePlaytimeFormat = '%s min'; + static const gamePlayersSingularFormat = '%i players'; + static const gamePlayersPluralFormat = '%i players'; + static const gamePlayersRangeFormat = '%i - %i players'; static const aboutPageTitle = 'About'; static const collectionsPageTitle = 'Collections'; diff --git a/board_games_companion/lib/models/hive/board_game_details.dart b/board_games_companion/lib/models/hive/board_game_details.dart index ccce2e07..17a74280 100644 --- a/board_games_companion/lib/models/hive/board_game_details.dart +++ b/board_games_companion/lib/models/hive/board_game_details.dart @@ -289,7 +289,19 @@ abstract class _BoardGameDetails extends BaseBoardGame with Store { } } - return sprintf(AppText.gamePlaytimeStatFormat, [playtimeRange]); + return sprintf(AppText.gamePlaytimeFormat, [playtimeRange]); + } + + String get playersFormatted { + if (_minPlayers == _maxPlayers || _maxPlayers == null) { + if (_minPlayers == 1) { + return sprintf(AppText.gamePlayersSingularFormat, [_minPlayers]); + } + + return sprintf(AppText.gamePlayersPluralFormat, [_minPlayers]); + } + + return sprintf(AppText.gamePlayersRangeFormat, [_minPlayers, _maxPlayers]); } String? get rankFormatted { diff --git a/board_games_companion/lib/pages/board_game_details/board_game_details_page.dart b/board_games_companion/lib/pages/board_game_details/board_game_details_page.dart index 439a1f11..5ac1f5cb 100644 --- a/board_games_companion/lib/pages/board_game_details/board_game_details_page.dart +++ b/board_games_companion/lib/pages/board_game_details/board_game_details_page.dart @@ -730,11 +730,7 @@ class _FirstRowGeneralInfoPanels extends StatelessWidget { mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Flexible( - child: _InfoPanel( - title: '${boardGameDetails!.minPlayers} - ${boardGameDetails!.maxPlayers} Players', - ), - ), + Flexible(child: _InfoPanel(title: boardGameDetails!.playersFormatted)), const SizedBox(width: Dimensions.standardSpacing), Flexible( child: _InfoPanel( diff --git a/board_games_companion/lib/pages/games/games_page.dart b/board_games_companion/lib/pages/games/games_page.dart index 99a54a29..5cb6d002 100644 --- a/board_games_companion/lib/pages/games/games_page.dart +++ b/board_games_companion/lib/pages/games/games_page.dart @@ -957,10 +957,7 @@ class _SearchResultGameDetails extends StatelessWidget { const SizedBox(height: Dimensions.standardSpacing), _SearchResultGameGeneralStats( icon: const Icon(Icons.people, size: _gameStatIconSize), - statistic: sprintf( - AppText.gamesPageSearchResultPlayersNumberGameStatFormat, - [boardGame.minPlayers, boardGame.maxPlayers], - ), + statistic: boardGame.playersFormatted, ), const SizedBox(height: Dimensions.standardSpacing), _SearchResultGameGeneralStats(