-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
following featured have been covered: - create event - register in event - create and get notes for events - check no of registrations - see dairy page, events in which you are registered - save contact from a hand written document to your phone just in one click - Alhamdulilah for every thing
- Loading branch information
1 parent
58bb8e5
commit 0beafb3
Showing
23 changed files
with
1,225 additions
and
671 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java
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,25 @@ | ||
// Generated file. | ||
// | ||
// If you wish to remove Flutter's multidex support, delete this entire file. | ||
// | ||
// Modifications to this file should be done in a copy under a different name | ||
// as this file may be regenerated. | ||
|
||
package io.flutter.app; | ||
|
||
import android.app.Application; | ||
import android.content.Context; | ||
import androidx.annotation.CallSuper; | ||
import androidx.multidex.MultiDex; | ||
|
||
/** | ||
* Extension of {@link android.app.Application}, adding multidex support. | ||
*/ | ||
public class FlutterMultiDexApplication extends Application { | ||
@Override | ||
@CallSuper | ||
protected void attachBaseContext(Context base) { | ||
super.attachBaseContext(base); | ||
MultiDex.install(this); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:firebase_storage/firebase_storage.dart'; | ||
import 'package:get/get.dart'; | ||
|
||
class Create { | ||
final database = FirebaseFirestore.instance; | ||
final FirebaseStorage storage = FirebaseStorage.instance; | ||
Future<void> createEvent(String uid, String title, String imagePath, | ||
String date, String time, String location, String notes) async { | ||
DocumentReference eventdocs = database | ||
.collection('users') | ||
.doc('events') | ||
.collection('eventsCollection') | ||
.doc(); | ||
String eventId=eventdocs.id; | ||
eventdocs.set({ | ||
'eventId':eventId, | ||
'OrganizerID': uid, | ||
'title': title, | ||
'imagePath': imagePath, | ||
'date': date, | ||
'time': time, | ||
'location': location, | ||
'notes': notes, | ||
'registrations': [] | ||
}).then((value) async {}); | ||
} | ||
|
||
Future<String> uploadImageAndGetUrl(imagePath) async { | ||
if (imagePath != null) { | ||
File file = File(imagePath); | ||
|
||
// Upload image to Firebase Storage | ||
String fileName = DateTime.now().millisecondsSinceEpoch.toString(); | ||
Reference storageReference = storage.ref().child('images/$fileName.jpg'); | ||
UploadTask uploadTask = storageReference.putFile(file); | ||
await uploadTask.whenComplete(() => null); | ||
|
||
// Get download URL | ||
String imageUrl = await storageReference.getDownloadURL(); | ||
|
||
// Save image URL in Firestore | ||
|
||
print('Image uploaded and URL saved: $imageUrl'); | ||
return imageUrl; | ||
} else { | ||
print('No image selected.'); | ||
return ''; | ||
} | ||
} | ||
|
||
Future<void> someOneRegistered(String eventId, String name) async { | ||
try{ | ||
DocumentReference eventdocs = database | ||
.collection('users') | ||
.doc('events') | ||
.collection('eventsCollection') | ||
.doc(eventId); | ||
eventdocs.update({ | ||
|
||
'registrations':FieldValue.arrayUnion([name]), | ||
}).then((value) async {}); | ||
} | ||
catch(e){ | ||
Get.snackbar('Error', e.toString()); | ||
} | ||
} | ||
|
||
} |
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 @@ | ||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:get/get.dart'; | ||
|
||
class RegistrationDatabase { | ||
final database = FirebaseFirestore.instance; | ||
|
||
Future<void> setUserName( | ||
String uid, | ||
String email, | ||
String name, | ||
) async { | ||
await database.collection('users').doc(uid).set({ | ||
'name': name, | ||
'email': email, | ||
'eventID': [], | ||
}).then((value) async { | ||
Get.snackbar('Congrat', 'You have been Registered'); | ||
}); | ||
} | ||
|
||
Future<String> getUserName( | ||
String uid, | ||
) async { | ||
DocumentSnapshot snapshot = | ||
await FirebaseFirestore.instance.collection('users').doc(uid).get(); | ||
|
||
final name = snapshot.data() as Map<String, dynamic>; | ||
return name['name'].toString(); | ||
} | ||
|
||
Future<void> registerInEvent(String uid, String eventID) async { | ||
try{ | ||
await database.collection('users').doc(uid).update({ | ||
'eventID': FieldValue.arrayUnion([eventID]), | ||
}).then((value) async { | ||
Get.snackbar('Congratulations', 'You have been Registered in this Event'); | ||
}); | ||
} | ||
catch(e){ | ||
Get.snackbar('Error', '${e.toString()}'); | ||
} | ||
} | ||
|
||
|
||
} |
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,41 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:firebase_storage/firebase_storage.dart'; | ||
|
||
class RetrieveEvents { | ||
Stream<QuerySnapshot> retrieveEventData() { | ||
final database = FirebaseFirestore.instance; | ||
Stream<QuerySnapshot> events = database | ||
.collection('users') | ||
.doc('events') | ||
.collection('eventsCollection') | ||
.snapshots(); | ||
return events; | ||
} | ||
|
||
Future<List<String>> Idees(uid) async { | ||
final database = FirebaseFirestore.instance; | ||
final snapshot = await database.collection('users').doc(uid).get(); | ||
List<String> Idees = snapshot.data()?['eventID']; | ||
return Idees; | ||
} | ||
|
||
retrieveMyEvents(uid) async { | ||
final database = FirebaseFirestore.instance; | ||
|
||
final snapshot = await database.collection('users').doc(uid).get(); | ||
final eventMap = snapshot.data() as Map<String, dynamic>; | ||
|
||
final Ids = eventMap['eventID']; | ||
|
||
final events = database | ||
.collection('users') | ||
.doc('events') | ||
.collection('eventsCollection') | ||
.where(FieldPath.documentId, whereIn: Ids) | ||
.get(); | ||
return events; | ||
} | ||
|
||
} |
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.