Skip to content

Commit

Permalink
code update
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalrk1 committed Nov 28, 2021
1 parent faee5a0 commit 44937d4
Show file tree
Hide file tree
Showing 9 changed files with 557 additions and 113 deletions.
79 changes: 79 additions & 0 deletions lib/DataProvider/DataUploader.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:onikiri_ui/models/ScenePack_model.dart';

import 'FireBase_Constants.dart';

class DataUploadProvider with ChangeNotifier {
bool isLoding = true;
bool isError = false;
String errorMessage;

Future<void> uploadScenePack(Map<String, dynamic> inputData) async {
try {
isLoding = true;
isError = false;
CollectionReference ref =
FirebaseFirestore.instance.collection(SCENE_PACKS);
ref.add({
'title': inputData['title'],
'link': inputData['link'],
'image': inputData['image'],
'credit': inputData['credit'],
});
isLoding = false;
print(isLoding);
notifyListeners();
} catch (e) {
isError = true;
notifyListeners();
errorMessage = "Something Went Wrong Please try again later";
print(e);
}
}

Future<void> uploadTutorial(Map<String, dynamic> inputData) async {
try {
isLoding = true;
isError = false;
CollectionReference ref = FirebaseFirestore.instance.collection(TUTORIAL);
ref.add({
'title': inputData['title'],
'link': inputData['link'],
'category': inputData['category'],
});
isLoding = false;
print(isLoding);
notifyListeners();
} catch (e) {
isError = true;
notifyListeners();
errorMessage = "Something Went Wrong Please try again later";
print(e);
}
}

Future<void> uploadProjectFile(Map<String, dynamic> inputData) async {
try {
isLoding = true;
isError = false;
CollectionReference ref =
FirebaseFirestore.instance.collection(PROJECT_FILE);
ref.add({
'title': inputData['title'],
'pflink': inputData['pflink'],
'editlink': inputData['editlink'],
'category': inputData['category'],
'credit': inputData['credit'],
});
isLoding = false;
print(isLoding);
notifyListeners();
} catch (e) {
isError = true;
notifyListeners();
errorMessage = "Something Went Wrong Please try again later";
print(e);
}
}
}

0 comments on commit 44937d4

Please sign in to comment.