diff --git a/live_score_flutter_app/README.md b/live_score_flutter_app/README.md
index 25efd67..8295c39 100644
--- a/live_score_flutter_app/README.md
+++ b/live_score_flutter_app/README.md
@@ -1,16 +1,87 @@
-# live_score_flutter_app
+# Live Score Flutter App
+
+
+
-A new Flutter project.
+Many times a lot of games like cricket, football, badminton are occuing in your college but you are very lazy to attend these live or maybe you are at your home or not available at college and unfortunately you have to miss these events and its thrill.
+But now no need to be disheartened, Live Score App will not only let you know the live score but also see its highlights moments. You will also get notified for the upcoming games in your college or any other college. You can take a look at the previous games too.
+Made using Firebase and Flutter
-## Getting Started
+## Features
-This project is a starting point for a Flutter application.
+- **Ongoing Section:** View the score and highlights live
+
+
+
+
-A few resources to get you started if this is your first Flutter project:
-- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
-- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
-For help getting started with Flutter development, view the
-[online documentation](https://docs.flutter.dev/), which offers tutorials,
-samples, guidance on mobile development, and a full API reference.
+- **Previous Section:** View the score, highlights and winner of the previous games
+
+
+
+
+
+
+- **Announcement Section:** Get notified about the upcoming games as well as choose to subscribe to your interest college notifications
+
+
+
+
+
+
+- **Authentication Section:** Login or signup to create games
+
+
+
+
+
+- **Admin Section:** Create games occuring in your college and update its score accordingly. You can also choose to notify users about upcoming games
+
+
+
+
+
+
+
+
+# Demo Video
+
+Here is the demo video of working of this app: [Watch the Video](https://youtu.be/RqpSwHATNSU)
+
+## How to Run
+
+1. Download or Clone the repo
+2. Install all the packages by typing the following command into your terminal
+
+ ```sh
+ flutter pub get
+ ```
+3. Go to [games-admin-provider](lib/providers/games_admin_provider.dart) file and replace **${dotenv.env["SERVER_KEY"]}** with the firebase server key
+
+```dart
+ Future sendNotificationToDevices(
+ String title, String body, String topic) async {
+ await http.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': 'key=${dotenv.env["SERVER_KEY"]}',
+ },
+ body: jsonEncode({
+ "condition": "'$topic' in topics || 'All' in topics",
+ 'notification': {
+ 'android_channel_id': 'pushnotificationapp',
+ 'title': title,
+ 'body': body,
+ },
+ }));
+ }
+```
+
+### Apk link:
+[Live Score Apk Download](https://drive.google.com/file/d/15Oe7inzXqqoRK0KAg_L7alOm9GaOZX8C/view?usp=share_link)
+
+## Contact
+
+- [Faiz Khan](https://github.com/FaizFk/) | [LinkedIn](https://linkedin.com/in/faiz-khan-4793731ba/)
diff --git a/live_score_flutter_app/Screenshots/admin-screen.jpg b/live_score_flutter_app/Screenshots/admin-screen.jpg
new file mode 100644
index 0000000..9be26de
Binary files /dev/null and b/live_score_flutter_app/Screenshots/admin-screen.jpg differ
diff --git a/live_score_flutter_app/Screenshots/announcement-settings.jpg b/live_score_flutter_app/Screenshots/announcement-settings.jpg
new file mode 100644
index 0000000..063b792
Binary files /dev/null and b/live_score_flutter_app/Screenshots/announcement-settings.jpg differ
diff --git a/live_score_flutter_app/Screenshots/announcements.jpg b/live_score_flutter_app/Screenshots/announcements.jpg
new file mode 100644
index 0000000..b20df17
Binary files /dev/null and b/live_score_flutter_app/Screenshots/announcements.jpg differ
diff --git a/live_score_flutter_app/Screenshots/auth-screen.jpg b/live_score_flutter_app/Screenshots/auth-screen.jpg
new file mode 100644
index 0000000..d3c3483
Binary files /dev/null and b/live_score_flutter_app/Screenshots/auth-screen.jpg differ
diff --git a/live_score_flutter_app/Screenshots/create-game.jpg b/live_score_flutter_app/Screenshots/create-game.jpg
new file mode 100644
index 0000000..b2ca961
Binary files /dev/null and b/live_score_flutter_app/Screenshots/create-game.jpg differ
diff --git a/live_score_flutter_app/Screenshots/live_score_icon.png b/live_score_flutter_app/Screenshots/live_score_icon.png
new file mode 100644
index 0000000..064b7f6
Binary files /dev/null and b/live_score_flutter_app/Screenshots/live_score_icon.png differ
diff --git a/live_score_flutter_app/Screenshots/login.jpg b/live_score_flutter_app/Screenshots/login.jpg
new file mode 100644
index 0000000..3618cb5
Binary files /dev/null and b/live_score_flutter_app/Screenshots/login.jpg differ
diff --git a/live_score_flutter_app/Screenshots/ongoing-details.jpg b/live_score_flutter_app/Screenshots/ongoing-details.jpg
new file mode 100644
index 0000000..81c994a
Binary files /dev/null and b/live_score_flutter_app/Screenshots/ongoing-details.jpg differ
diff --git a/live_score_flutter_app/Screenshots/ongoing.jpg b/live_score_flutter_app/Screenshots/ongoing.jpg
new file mode 100644
index 0000000..243dbaf
Binary files /dev/null and b/live_score_flutter_app/Screenshots/ongoing.jpg differ
diff --git a/live_score_flutter_app/Screenshots/previous-details.jpg b/live_score_flutter_app/Screenshots/previous-details.jpg
new file mode 100644
index 0000000..150ad24
Binary files /dev/null and b/live_score_flutter_app/Screenshots/previous-details.jpg differ
diff --git a/live_score_flutter_app/Screenshots/previous.jpg b/live_score_flutter_app/Screenshots/previous.jpg
new file mode 100644
index 0000000..54d0f66
Binary files /dev/null and b/live_score_flutter_app/Screenshots/previous.jpg differ
diff --git a/live_score_flutter_app/Screenshots/score-controller.jpg b/live_score_flutter_app/Screenshots/score-controller.jpg
new file mode 100644
index 0000000..813c255
Binary files /dev/null and b/live_score_flutter_app/Screenshots/score-controller.jpg differ
diff --git a/live_score_flutter_app/Screenshots/signup.jpg b/live_score_flutter_app/Screenshots/signup.jpg
new file mode 100644
index 0000000..147c07b
Binary files /dev/null and b/live_score_flutter_app/Screenshots/signup.jpg differ
diff --git a/live_score_flutter_app/android/app/src/main/AndroidManifest.xml b/live_score_flutter_app/android/app/src/main/AndroidManifest.xml
index f757622..330b4b1 100644
--- a/live_score_flutter_app/android/app/src/main/AndroidManifest.xml
+++ b/live_score_flutter_app/android/app/src/main/AndroidManifest.xml
@@ -1,7 +1,7 @@
backgroundHandler(RemoteMessage message) async {
print(message.data.toString());
print(message.notification!.title);
@@ -74,13 +73,15 @@ class _MyAppState extends State {
}
},
);
+
+ //Subscribing to topic 'All' if first installing the app
+ GameUsersProvider.subscribeToAllIfFirstTime();
}
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
bool isAuth = FirebaseAuth.instance.currentUser != null;
-
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => GamesAdminProvider()),
diff --git a/live_score_flutter_app/lib/providers/games_admin_provider.dart b/live_score_flutter_app/lib/providers/games_admin_provider.dart
index 107c8f8..ffe8769 100644
--- a/live_score_flutter_app/lib/providers/games_admin_provider.dart
+++ b/live_score_flutter_app/lib/providers/games_admin_provider.dart
@@ -32,16 +32,15 @@ class GamesAdminProvider extends ChangeNotifier {
notifyListeners();
}
- Future sendNotificationToDevices(String title, String body) async {
+ Future sendNotificationToDevices(
+ String title, String body, String topic) async {
await http.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
headers: {
'Content-Type': 'application/json',
'Authorization': 'key=${dotenv.env["SERVER_KEY"]}',
},
body: jsonEncode({
- "registration_ids": [
- "f63uvo1ORx-dMmGaZkkO3w:APA91bH4Js6NtsmiFvEWAYHDk_1MWsKAsJYtp621i5QnHBxwnq6otIjhTH52raY4iOW4_juE--BPj2rpBVRdG1krUdR4t8YWN1JBAonQLBTVxd1RMz7FvhYypij6yLELZye67SsIt3WW"
- ],
+ "condition": "'$topic' in topics || 'All' in topics",
'notification': {
'android_channel_id': 'pushnotificationapp',
'title': title,
@@ -64,7 +63,10 @@ class GamesAdminProvider extends ChangeNotifier {
id: myDoc.id,
);
await myDoc.set(announcement.toJson());
- await sendNotificationToDevices('${announcement.creatorName} (${announcement.collegeName})', announcement.message);
+ await sendNotificationToDevices(
+ '${announcement.creatorName} (${announcement.collegeName})',
+ announcement.message,
+ announcement.collegeName.replaceAll(' ', ''));
Utils.showSnackbar('Your message was announced');
} catch (e) {
print(e);
@@ -117,28 +119,32 @@ class GamesAdminProvider extends ChangeNotifier {
Future changeScore(
{bool isIncrease = true, bool isScore1 = true}) async {
- if (isScore1) {
- if (isIncrease) {
- await _dbOngoingGamesRT
- .child('${currentGame.id}/score1')
- .set(++_currentGame.score1);
- } else {
- await _dbOngoingGamesRT
- .child('${currentGame.id}/score1')
- .set(_currentGame.score1 > 0 ? --_currentGame.score1 : 0);
- }
- } else {
- if (isIncrease) {
- await _dbOngoingGamesRT
- .child('${currentGame.id}/score2')
- .set(++_currentGame.score2);
+ try {
+ if (isScore1) {
+ if (isIncrease) {
+ await _dbOngoingGamesRT
+ .child('${currentGame.id}/score1')
+ .set(++_currentGame.score1);
+ } else {
+ await _dbOngoingGamesRT
+ .child('${currentGame.id}/score1')
+ .set(_currentGame.score1 > 0 ? --_currentGame.score1 : 0);
+ }
} else {
- await _dbOngoingGamesRT
- .child('${currentGame.id}/score2')
- .set((_currentGame.score2) > 0 ? --_currentGame.score2 : 0);
+ if (isIncrease) {
+ await _dbOngoingGamesRT
+ .child('${currentGame.id}/score2')
+ .set(++_currentGame.score2);
+ } else {
+ await _dbOngoingGamesRT
+ .child('${currentGame.id}/score2')
+ .set((_currentGame.score2) > 0 ? --_currentGame.score2 : 0);
+ }
}
+ notifyListeners();
+ } catch (e) {
+ Utils.showSnackbar('Please check your internet connection');
}
- notifyListeners();
}
Future sendKeyMoments(String message) async {
diff --git a/live_score_flutter_app/lib/providers/games_users_provider.dart b/live_score_flutter_app/lib/providers/games_users_provider.dart
index 8fd037d..654d9ac 100644
--- a/live_score_flutter_app/lib/providers/games_users_provider.dart
+++ b/live_score_flutter_app/lib/providers/games_users_provider.dart
@@ -95,14 +95,76 @@ class GameUsersProvider extends ChangeNotifier {
Future> getAllCollegesOngoing() async {
List collegeList = [];
- final snapshotGames = await _dbOngoingGamesRT.get();
- if (snapshotGames.exists) {
- Map result =
- snapshotGames.value as Map;
- collegeList = List.from(result.values.map((e) {
- return e['college'];
- }).toSet());
+ try {
+ final snapshotGames = await _dbOngoingGamesRT.get();
+ if (snapshotGames.exists) {
+ Map result =
+ snapshotGames.value as Map;
+ collegeList = List.from(result.values.map((e) {
+ return e['college'];
+ }).toSet());
+ }
+ } catch (e) {
+ Utils.showSnackbar("Something went wrong");
}
return collegeList;
}
+
+ Future