Skip to content

Commit

Permalink
Merge pull request #582 from bounswe/feature/MB/427/home_page
Browse files Browse the repository at this point in the history
Reorganized the Home Page
  • Loading branch information
kardelenerdal committed Nov 26, 2023
2 parents 7a964e2 + b7a6c64 commit adf15d5
Show file tree
Hide file tree
Showing 7 changed files with 494 additions and 300 deletions.
40 changes: 40 additions & 0 deletions ludos/mobile/lib/forum_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'games_page.dart';
import 'helper/APIService.dart';
import 'helper/colors.dart';
import 'main.dart';
import 'reusable_widgets/forum_thread.dart';
import 'dart:convert';
import 'package:ludos_mobile_app/userProvider.dart';
Expand Down Expand Up @@ -160,6 +162,44 @@ class _ForumPageState extends State<ForumPage> {
],
),
),
bottomNavigationBar: Container(
color: MyColors.orange,
padding: const EdgeInsets.all(10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconButton(
color: MyColors.white,
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => Home(),
));
},
icon: const Icon(Icons.home)),
IconButton(
color: MyColors.white,
onPressed: () {
},
icon: const Icon(Icons.group)),
IconButton(
color: MyColors.white,
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => GamesPage(token: widget.token, userProvider: widget.userProvider),
));
},
icon: const Icon(Icons.games)),
IconButton(
color: MyColors.white,
onPressed: () {},
icon: const Icon(Icons.favorite)),
IconButton(
color: MyColors.white,
onPressed: () {},
icon: const Icon(Icons.search_outlined)),
],
)
),
);
}
}
Expand Down
40 changes: 40 additions & 0 deletions ludos/mobile/lib/game_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import 'package:ludos_mobile_app/reusable_widgets/game_review.dart';
import 'package:ludos_mobile_app/userProvider.dart';
import 'forum_page.dart';
import 'game_properties.dart';
import 'games_page.dart';
import 'game_reviews_page.dart';
import 'helper/colors.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'helper/APIService.dart';
import 'login_page.dart';
import 'main.dart';

class GamePage extends StatefulWidget {
final UserProvider userProvider;
Expand Down Expand Up @@ -746,6 +748,44 @@ class _GamePageState extends State<GamePage> {
],
),
),
bottomNavigationBar: Container(
color: MyColors.orange,
padding: const EdgeInsets.all(10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconButton(
color: MyColors.white,
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => Home(),
));
},
icon: const Icon(Icons.home)),
IconButton(
color: MyColors.white,
onPressed: () {
},
icon: const Icon(Icons.group)),
IconButton(
color: MyColors.white,
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => GamesPage(token: widget.token, userProvider: widget.userProvider),
));
},
icon: const Icon(Icons.games)),
IconButton(
color: MyColors.white,
onPressed: () {},
icon: const Icon(Icons.favorite)),
IconButton(
color: MyColors.white,
onPressed: () {},
icon: const Icon(Icons.search_outlined)),
],
)
),
);
}
}
36 changes: 36 additions & 0 deletions ludos/mobile/lib/games_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:ludos_mobile_app/userProvider.dart';
import 'helper/colors.dart';
import 'login_page.dart';
import 'main.dart';
import 'reusable_widgets/game_summary.dart';
import 'helper/APIService.dart';
import 'create_game.dart';
Expand Down Expand Up @@ -208,6 +209,41 @@ class _GamesPageState extends State<GamesPage> {
],
),
),
bottomNavigationBar: Container(
color: MyColors.orange,
padding: const EdgeInsets.all(10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconButton(
color: MyColors.white,
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => Home(),
));
},
icon: const Icon(Icons.home)),
IconButton(
color: MyColors.white,
onPressed: () {
},
icon: const Icon(Icons.group)),
IconButton(
color: MyColors.white,
onPressed: () {
},
icon: const Icon(Icons.games)),
IconButton(
color: MyColors.white,
onPressed: () {},
icon: const Icon(Icons.favorite)),
IconButton(
color: MyColors.white,
onPressed: () {},
icon: const Icon(Icons.search_outlined)),
],
)
),
);
}
}
17 changes: 15 additions & 2 deletions ludos/mobile/lib/helper/APIService.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ class APIService {
return response;
}

Future<http.Response> listGames(String? authToken) async {
var uri = Uri.parse("$baseURL/game?limit=20");
Future<http.Response> listGames(String? authToken, {String limit = "20"}) async {
var uri = Uri.parse("$baseURL/game?limit=$limit");
final response = await http.get(uri, headers: {
'content-type': "application/json",
'Authorization': 'Bearer $authToken'
Expand Down Expand Up @@ -313,6 +313,18 @@ class APIService {
return response;
}


Future<http.Response> listAllThreads(String? authToken, {String limit = "20"}) async {
var uri = Uri.parse("$baseURL/post?limit=$limit");
final response = await http.get(uri, headers: {
'content-type': "application/json",
'Authorization': 'Bearer $authToken'
});

return response;
}


Future<http.Response> editGame(
String? authToken,
String gameId,
Expand Down Expand Up @@ -357,4 +369,5 @@ class APIService {
});
return response;
}

}

0 comments on commit adf15d5

Please sign in to comment.