-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pavants777
committed
Jan 5, 2024
1 parent
d573123
commit 50640d4
Showing
29 changed files
with
1,085 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>API_KEY</key> | ||
<string>AIzaSyDXlrub_RNZaFaep0eDEBg0p6bDoHGMEKs</string> | ||
<key>GCM_SENDER_ID</key> | ||
<string>754779193821</string> | ||
<key>PLIST_VERSION</key> | ||
<string>1</string> | ||
<key>BUNDLE_ID</key> | ||
<string>com.example.cmc</string> | ||
<key>PROJECT_ID</key> | ||
<string>cmc1-820fd</string> | ||
<key>STORAGE_BUCKET</key> | ||
<string>cmc1-820fd.appspot.com</string> | ||
<key>IS_ADS_ENABLED</key> | ||
<false></false> | ||
<key>IS_ANALYTICS_ENABLED</key> | ||
<false></false> | ||
<key>IS_APPINVITE_ENABLED</key> | ||
<true></true> | ||
<key>IS_GCM_ENABLED</key> | ||
<true></true> | ||
<key>IS_SIGNIN_ENABLED</key> | ||
<true></true> | ||
<key>GOOGLE_APP_ID</key> | ||
<string>1:754779193821:ios:5d61ac3b647710841c3634</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"file_generated_by": "FlutterFire CLI", | ||
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", | ||
"GOOGLE_APP_ID": "1:754779193821:ios:5d61ac3b647710841c3634", | ||
"FIREBASE_PROJECT_ID": "cmc1-820fd", | ||
"GCM_SENDER_ID": "754779193821" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:cmc/Models/QuestionPaperModel.dart'; | ||
import 'package:cmc/Models/UserModels.dart'; | ||
import 'package:cmc/Provider/UserProvider.dart'; | ||
import 'package:cmc/Utills/getXSnackBar.dart'; | ||
import 'package:firebase_auth/firebase_auth.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
class StudentFunction { | ||
static Stream<List<UserModels>> getStudent(BuildContext context) async* { | ||
var _user = Provider.of<UserProvider>(context, listen: false); | ||
|
||
try { | ||
yield* FirebaseFirestore.instance | ||
.collection('users') | ||
.where('collegeName', isEqualTo: _user.user?.collegeName) | ||
.snapshots() | ||
.map((event) { | ||
return event.docs.map((e) { | ||
return UserModels.fromJson(e.data() as Map<String, dynamic>); | ||
}).toList(); | ||
}); | ||
} catch (e) { | ||
print('Error While Fetching Data: $e'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:cmc/Models/QuestionPaperModel.dart'; | ||
import 'package:cmc/Provider/UserProvider.dart'; | ||
import 'package:cmc/Utills/getXSnackBar.dart'; | ||
import 'package:firebase_auth/firebase_auth.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
class QuestionFunction { | ||
static Future<void> sendQuestionPaper(String name, fileUrl, year, sem, | ||
subjectName, bool isSem, BuildContext context) async { | ||
try { | ||
var _user = Provider.of<UserProvider>(context, listen: false); | ||
DocumentReference ref = FirebaseFirestore.instance | ||
.collection('Question') | ||
.doc('${_user.user?.collegeName}') | ||
.collection('${_user.user?.branch}') | ||
.doc(); | ||
|
||
String refId = ref.id; | ||
QuestionModel data = QuestionModel( | ||
refId: refId, | ||
name: name, | ||
fileUrl: fileUrl, | ||
year: year, | ||
sem: sem, | ||
collegeName: _user.user!.collegeName, | ||
subjects: subjectName, | ||
isSem: isSem); | ||
|
||
await ref.set(data.toMap()); | ||
Navigator.pop(context); | ||
} on FirebaseException catch (e) { | ||
GetXSnackbar("Error While Sending Question Paper", e.message); | ||
} | ||
} | ||
|
||
static Stream<List<QuestionModel>> getQuestionPage( | ||
BuildContext context) async* { | ||
var _user = Provider.of<UserProvider>(context, listen: false); | ||
|
||
yield* FirebaseFirestore.instance | ||
.collection('Question') | ||
.doc(_user.user?.collegeName ?? "Unknown") | ||
.collection(_user.user!.branch) | ||
.snapshots() | ||
.map((event) { | ||
return event.docs.map((e) => QuestionModel.fromJson(e.data())).toList(); | ||
}); | ||
} | ||
} | ||
|
||
|
||
// yield* FirebaseFirestore.instance | ||
// .collection('Data') | ||
// .doc(uid) | ||
// .collection('works') | ||
// .snapshots() | ||
// .map((event) { | ||
// return event.docs.map((e) => Models.fromJson(e.data())).toList(); | ||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
class QuestionModel { | ||
String name; | ||
String fileUrl; | ||
String year; | ||
String sem; | ||
String collegeName; | ||
String subjects; | ||
bool isSem; | ||
String refId; | ||
|
||
QuestionModel( | ||
{required this.name, | ||
required this.fileUrl, | ||
required this.year, | ||
required this.sem, | ||
required this.collegeName, | ||
required this.subjects, | ||
required this.isSem, | ||
required this.refId}); | ||
|
||
factory QuestionModel.fromJson(Map<String, dynamic> json) { | ||
return QuestionModel( | ||
name: json['name'], | ||
fileUrl: json['fileUrl'], | ||
year: json['year'], | ||
sem: json['sem'], | ||
collegeName: json['collegeName'], | ||
subjects: json['subjects'], | ||
isSem: json['isSem'], | ||
refId: json['refId']); | ||
} | ||
|
||
Map<String, dynamic> toMap() { | ||
return { | ||
'refId': refId, | ||
'name': name, | ||
'fileUrl': fileUrl, | ||
'year': year, | ||
'sem': sem, | ||
'collegeName': collegeName, | ||
'subjects': subjects, | ||
'isSem': isSem, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.