Skip to content

Commit

Permalink
#664 created customized bottom navigation bar
Browse files Browse the repository at this point in the history
  • Loading branch information
frknlke committed Dec 8, 2023
1 parent 8f86742 commit 15f1a34
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 189 deletions.
40 changes: 2 additions & 38 deletions ludos/mobile/lib/forum_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'reusable_widgets/forum_thread.dart';
import 'dart:convert';
import 'package:ludos_mobile_app/userProvider.dart';
import 'create_thread_page.dart';
import 'reusable_widgets/custom_navigation_bar.dart';

class ForumPage extends StatefulWidget {
final String? token;
Expand Down Expand Up @@ -234,44 +235,7 @@ 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)),
],
)
),
bottomNavigationBar: CustomNavigationBar(userProvider: widget.userProvider),
);
}
}
Expand Down
40 changes: 2 additions & 38 deletions ludos/mobile/lib/game_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'helper/APIService.dart';
import 'login_page.dart';
import 'main.dart';
import 'reusable_widgets/custom_navigation_bar.dart';

class GamePage extends StatefulWidget {
final VoidCallback onRefresh;
Expand Down Expand Up @@ -767,44 +768,7 @@ 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)),
],
)
),
bottomNavigationBar: CustomNavigationBar(userProvider: widget.userProvider),
);
}
}
37 changes: 2 additions & 35 deletions ludos/mobile/lib/games_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'main.dart';
import 'reusable_widgets/game_summary.dart';
import 'helper/APIService.dart';
import 'create_game.dart';
import 'reusable_widgets/custom_navigation_bar.dart';

class GamesPage extends StatefulWidget {
final String? token;
Expand Down Expand Up @@ -218,41 +219,7 @@ 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)),
],
)
),
bottomNavigationBar: CustomNavigationBar(userProvider: widget.userProvider),
);
}
}
16 changes: 13 additions & 3 deletions ludos/mobile/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import 'games_page.dart';
import 'userProvider.dart';
import 'package:provider/provider.dart';
import 'helper/colors.dart';
import 'search_page.dart';
import 'reusable_widgets/custom_navigation_bar.dart';

void main() => runApp(ChangeNotifierProvider(
create: (context) => UserProvider(),
Expand Down Expand Up @@ -237,7 +239,7 @@ class _HomeState extends State<Home> {
Column(
children: [
const SizedBox(height: 10),
Text(
const Text(
"Favorite Games",
style: TextStyle(
color: MyColors.orange,
Expand Down Expand Up @@ -278,7 +280,7 @@ class _HomeState extends State<Home> {
Column(
children: [
const SizedBox(height: 10),
Text(
const Text(
"Trending Topics",
style: TextStyle(
color: MyColors.orange,
Expand Down Expand Up @@ -317,6 +319,7 @@ class _HomeState extends State<Home> {
)
],
),
/*
bottomNavigationBar: Container(
color: MyColors.orange,
padding: const EdgeInsets.all(10.0),
Expand Down Expand Up @@ -346,11 +349,18 @@ class _HomeState extends State<Home> {
icon: const Icon(Icons.favorite)),
IconButton(
color: MyColors.white,
onPressed: () {},
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
//builder: (context) => GamesPage(token: userProvider.token, userProvider: userProvider),
builder: (context) => SearchPage(),
));
},
icon: const Icon(Icons.search_outlined)),
],
)
),
*/
bottomNavigationBar: CustomNavigationBar(userProvider: userProvider),
);
}
}
67 changes: 67 additions & 0 deletions ludos/mobile/lib/reusable_widgets/custom_navigation_bar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:ludos_mobile_app/change_password.dart';
import 'package:ludos_mobile_app/user_profile_page.dart';
import 'package:ludos_mobile_app/reusable_widgets/forum_thread.dart';
import 'package:ludos_mobile_app/reusable_widgets/home_game_sum.dart';
import '../helper/APIService.dart';
import '../login_page.dart';
import '../games_page.dart';
import '../userProvider.dart';
import 'package:provider/provider.dart';
import '../helper/colors.dart';
import '../search_page.dart';
import '../main.dart';

class CustomNavigationBar extends StatelessWidget {
final UserProvider userProvider;
const CustomNavigationBar({super.key, required this.userProvider});

@override
Widget build(BuildContext context) {
return 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: userProvider.token, userProvider: userProvider),
));
},
icon: const Icon(Icons.games)),
IconButton(
color: MyColors.white,
onPressed: () {},
icon: const Icon(Icons.favorite)),
IconButton(
color: MyColors.white,
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
//builder: (context) => GamesPage(token: userProvider.token, userProvider: userProvider),
builder: (context) => SearchPage(),
));
},
icon: const Icon(Icons.search_outlined)),
],
));
}
}


37 changes: 2 additions & 35 deletions ludos/mobile/lib/search_game.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'main.dart';
import 'reusable_widgets/game_summary.dart';
import 'helper/APIService.dart';
import 'create_game.dart';
import 'reusable_widgets/custom_navigation_bar.dart';

class SearchGame extends StatefulWidget {
final String? searchKey;
Expand Down Expand Up @@ -182,41 +183,7 @@ class _SearchGameState extends State<SearchGame> {
],
),
),
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)),
],
)
),
bottomNavigationBar: CustomNavigationBar(userProvider: widget.userProvider),
);
}
}
Expand Down
46 changes: 46 additions & 0 deletions ludos/mobile/lib/search_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import 'dart:convert';
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';

class SearchPage extends StatefulWidget {
const SearchPage({super.key});

@override
State<SearchPage> createState() => _SearchPageState();
}

class _SearchPageState extends State<SearchPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColors.darkBlue,
appBar: AppBar(
backgroundColor: const Color(0xFFf89c34),
title: Text(
'Search',
style: TextStyle(
color: MyColors.white,
fontSize: 30,
),
),
),
body: Center(
child: Text(
'Search Page',
style: TextStyle(
color: MyColors.white,
fontSize: 30,
),
),
),
);
}
}


0 comments on commit 15f1a34

Please sign in to comment.