especializaciones
This commit is contained in:
@@ -312,18 +312,63 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showChoiceDialogEspecializaciones(BuildContext context) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
content: SingleChildScrollView(
|
||||
child: ListBody(
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: const Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Abrir Galería",
|
||||
style: TextStyle(color: Color(0xFF2BA4EC)),
|
||||
),
|
||||
onTap: () async {
|
||||
final List<File>? images = await getPdfs();
|
||||
if (images != null) {
|
||||
setState(() {
|
||||
images_especializacion = images;
|
||||
});
|
||||
}
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<List<File>?> getPdfs() async {
|
||||
FilePickerResult? result = await FilePicker.platform.pickFiles(
|
||||
type: FileType.custom,
|
||||
allowedExtensions: ['pdf'],
|
||||
allowMultiple: true,
|
||||
);
|
||||
|
||||
if (result != null) {
|
||||
List<File> files = result.files.map((file) => File(file.path!)).toList();
|
||||
return files;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<String>> uploadEspecializaciones(List<File> images) async {
|
||||
List<String> photoPaths = [];
|
||||
|
||||
for (File image in images) {
|
||||
final String namefile = image.path.split('/').last;
|
||||
|
||||
Reference ref = storage
|
||||
.ref()
|
||||
.child('users')
|
||||
.child(uid!)
|
||||
.child('especializaciones')
|
||||
.child(namefile);
|
||||
.child('e${DateTime.now().millisecondsSinceEpoch}.pdf');
|
||||
|
||||
final UploadTask uploadTask = ref.putFile(image);
|
||||
|
||||
@@ -671,11 +716,7 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
||||
SizedBox(height: _space),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
final images = await getImage(3);
|
||||
setState(() {
|
||||
images_especializacion =
|
||||
images.map((e) => File(e!.path)).toList();
|
||||
});
|
||||
_showChoiceDialogEspecializaciones(context);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFD6F4FF),
|
||||
|
||||
Reference in New Issue
Block a user