post capsule

posts_EKA-DDA
Lucas Delanier 2 years ago
parent d028568030
commit de013faa30

@ -254,6 +254,27 @@
</list>
</value>
</entry>
<entry key="firebase_storage">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_storage-11.2.5/lib" />
</list>
</value>
</entry>
<entry key="firebase_storage_platform_interface">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_storage_platform_interface-4.4.4/lib" />
</list>
</value>
</entry>
<entry key="firebase_storage_web">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_storage_web-3.6.5/lib" />
</list>
</value>
</entry>
<entry key="flutter">
<value>
<list>
@ -755,6 +776,9 @@
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_core-2.15.0/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_core_platform_interface-4.8.0/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_core_web-2.6.0/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_storage-11.2.5/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_storage_platform_interface-4.4.4/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_storage_web-3.6.5/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_animated_play_button-0.3.0/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.2/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.15/lib" />

@ -94,8 +94,10 @@ class _PostScreenState extends State<PostScreen>
}
handleSubmit() async {
print("ccccccccccccc");
await MyApp.postViewModel.addPost(
description, (selectedMusic?.id)!, selectedImage, selectedCity);
print("ccccccccccccc");
quit();
}

@ -9,24 +9,26 @@ class PostService {
createPost(String? description, String idMusic, File? image,
Tuple2<String, String>? location) async {
var id = MyApp.userViewModel.userCurrent.id;
final post = <String, dynamic>{
"user_id": id,
"description": description,
"date": DateTime.now(),
"place": [location?.item1, location?.item2],
"selfie": null,
"song_id": idMusic,
"likes": 0
};
var postAdd = await MyApp.db.collection("posts").add(post);
print("cc");
if (image != null) {
var imageUrl = FirebaseStorage.instance.ref(id + postAdd.id);
await imageUrl.putFile(image);
print("cc3");
var imageRef = FirebaseStorage.instance.ref('$id${postAdd.id}.jpg');
await imageRef.putFile(image);
var imageUrl = await imageRef.getDownloadURL();
print(imageUrl);
postAdd.update({"selfie": imageUrl});
}
print("cc2");
}
deletePost() {}

Loading…
Cancel
Save