Skip to content

Commit

Permalink
last update
Browse files Browse the repository at this point in the history
  • Loading branch information
pavants777 committed Jan 5, 2024
1 parent d573123 commit 50640d4
Show file tree
Hide file tree
Showing 29 changed files with 1,085 additions and 151 deletions.
19 changes: 19 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:754779193821:android:1a9ec8fcecd9faae1c3634",
"android_client_info": {
"package_name": "com.example.hackathon"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyCbcWWvVTLVeDlYB9s9uzcR_5uSlO3EZHY"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
Expand Down
Binary file added assets/logo2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions ios/Runner/GoogleService-Info.plist
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>
7 changes: 7 additions & 0 deletions ios/firebase_app_id_file.json
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"
}
28 changes: 28 additions & 0 deletions lib/Function/getStudent.dart
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');
}
}
}
61 changes: 61 additions & 0 deletions lib/Function/question.dart
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();
// });
45 changes: 45 additions & 0 deletions lib/Models/QuestionPaperModel.dart
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,
};
}
}
43 changes: 27 additions & 16 deletions lib/Screens/Groups/ChatPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,26 @@ class _ChatPageState extends State<ChatPage> {
}

Future<void> getUser() async {
var querySnapshot =
await FirebaseFirestore.instance.collection('users').get();
GroupModels demogroup =
await FirebaseGroupFunction.getGroup(widget.groupId);
setState(() {
group = demogroup;
users = querySnapshot.docs
.map((doc) => UserModels.fromJson(doc.data()))
.toList();
});
try {
var querySnapshot =
await FirebaseFirestore.instance.collection('users').get();

if (widget.groupId != null) {
GroupModels demogroup =
await FirebaseGroupFunction.getGroup(widget.groupId!);
if (demogroup != null) {
setState(() {
group = demogroup;
users = querySnapshot.docs
.map((doc) =>
UserModels.fromJson(doc.data() as Map<String, dynamic>))
.toList();
});
} else {}
} else {}
} catch (error) {
print('Error in getUser: $error');
}
}

_sendMessagetoGroup() async {
Expand Down Expand Up @@ -98,8 +108,8 @@ class _ChatPageState extends State<ChatPage> {
backgroundColor: Colors.pink,
child: CircleAvatar(
maxRadius: screenWidth * 0.045,
backgroundImage: NetworkImage(
group?.profileUrl ?? Constant.image),
backgroundImage:
NetworkImage(group?.profileUrl ?? Constant.image),
),
),
SizedBox(
Expand Down Expand Up @@ -171,10 +181,11 @@ class _ChatPageState extends State<ChatPage> {
text: 'Create New Work',
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
CreateToDo(group: group)));
context,
MaterialPageRoute(
builder: (context) => CreateToDo(group: group),
),
);
},
),
];
Expand Down
7 changes: 4 additions & 3 deletions lib/Screens/Groups/CreateNewGroup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ class CreateNewGroup extends StatefulWidget {
}

class _CreateNewGroupState extends State<CreateNewGroup> {
final TextEditingController _groupNameEditingController = TextEditingController();
final TextEditingController _groupNameEditingController =
TextEditingController();
final TextEditingController _tagsEditingController = TextEditingController();
String profileUrl = Constant.image;
File? image;
List<String> tags = [];

Future<void> selectImage() async {
File? image = await pickImageFromGallery(context);
File? imagePath = await pickImageFromGallery(context);
setState(() {
image = image;
image = imagePath;
});
}

Expand Down
Loading

0 comments on commit 50640d4

Please sign in to comment.