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 {
|
Future<List<String>> uploadEspecializaciones(List<File> images) async {
|
||||||
List<String> photoPaths = [];
|
List<String> photoPaths = [];
|
||||||
|
|
||||||
for (File image in images) {
|
for (File image in images) {
|
||||||
final String namefile = image.path.split('/').last;
|
|
||||||
|
|
||||||
Reference ref = storage
|
Reference ref = storage
|
||||||
.ref()
|
.ref()
|
||||||
.child('users')
|
.child('users')
|
||||||
.child(uid!)
|
.child(uid!)
|
||||||
.child('especializaciones')
|
.child('especializaciones')
|
||||||
.child(namefile);
|
.child('e${DateTime.now().millisecondsSinceEpoch}.pdf');
|
||||||
|
|
||||||
final UploadTask uploadTask = ref.putFile(image);
|
final UploadTask uploadTask = ref.putFile(image);
|
||||||
|
|
||||||
@@ -671,11 +716,7 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
|||||||
SizedBox(height: _space),
|
SizedBox(height: _space),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final images = await getImage(3);
|
_showChoiceDialogEspecializaciones(context);
|
||||||
setState(() {
|
|
||||||
images_especializacion =
|
|
||||||
images.map((e) => File(e!.path)).toList();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: const Color(0xFFD6F4FF),
|
backgroundColor: const Color(0xFFD6F4FF),
|
||||||
|
|||||||
Reference in New Issue
Block a user