This commit is contained in:
Juan Felipe Duarte
2023-04-06 11:26:22 -05:00
parent de3d85f997
commit d83130b01d
8 changed files with 472 additions and 71 deletions
@@ -0,0 +1,13 @@
import 'package:image_picker/image_picker.dart';
Future<XFile?> getImage(opc) async {
final ImagePicker picker = ImagePicker();
if (opc == 1) {
XFile? image = await picker.pickImage(source: ImageSource.camera);
return image;
} else {
XFile? image = await picker.pickImage(source: ImageSource.gallery);
return image;
}
}
+24
View File
@@ -0,0 +1,24 @@
import 'dart:io';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_storage/firebase_storage.dart';
// final FirebaseStorage storage = FirebaseStorage.instance;
// Future<bool> uploadImage(File image) async {
// final String namefile = image.path.split('/').last;
// Reference ref = storage.ref().child('profile').child(namefile);
// final UploadTask uploadTask = ref.putFile(image);
// final TaskSnapshot snapshot = await uploadTask.whenComplete(() => true);
// final String url = await snapshot.ref.getDownloadURL();
// if (snapshot.state == TaskState.success) {
// return true;
// } else {
// return false;
// }
// }