Skip to content

Commit

Permalink
Merge pull request #679 from bounswe/mobile/hotfix/game-genres-platforms
Browse files Browse the repository at this point in the history
[Mobile] game page genres and platforms multiple show
  • Loading branch information
erkamkavak authored Dec 26, 2023
2 parents 15e89d4 + e4f2e45 commit 7304d8c
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions app/mobile/lib/presentation/pages/game_wiki_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ class _GameWikiPageState extends State<GameWikiPage>

final List<String> controllerNames = ['Name', 'Description'];

static late List<String> platforms = [];
static late List<String> genres = [];

static late String genretoshow = "";

Future<Game> loadGame(int gameId) async {
Game game = await gameService.getGame(gameId);
List<Post> postList = await postService.getPostsByGame(gameId);
Expand All @@ -128,6 +133,26 @@ class _GameWikiPageState extends State<GameWikiPage>

game.relatedPosts = postList;

platforms = [];

for(var i = 0; i < game.platforms!.length; i++) {
platforms.add(game.platforms![i]);
platforms.add(", ");
}

platforms.removeLast();

genres = [];

for(var i = 0; i < game.genres!.length; i++) {
genres.add(game.genres![i]);
genres.add(", ");
}

genres.removeLast();

genretoshow = genres.join("");

return game;
}

Expand Down Expand Up @@ -214,7 +239,7 @@ class _GameWikiPageState extends State<GameWikiPage>
fontWeight: FontWeight.w600))),
Align(
alignment: Alignment.centerLeft,
child: Text(game.genres![0] ?? "-",
child: Text(genres.join("") ?? "-",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400))),
Expand Down Expand Up @@ -322,9 +347,10 @@ class _GameWikiPageState extends State<GameWikiPage>
style:
TextStyle(fontWeight: FontWeight.w500),
),
TextSpan(
text: game.platforms![0],
)
for (String platform in platforms)
TextSpan(
text: platform,
),
],
)),
),
Expand Down

0 comments on commit 7304d8c

Please sign in to comment.