From 2dd4fc3e7a2cacf88c660cd51b5da6f80e00bc15 Mon Sep 17 00:00:00 2001 From: Felipe Date: Mon, 31 Jul 2023 18:22:32 -0500 Subject: [PATCH] especializaciones --- lib/src/screens/professional_profile.dart | 57 +++++++++++++++++++---- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/lib/src/screens/professional_profile.dart b/lib/src/screens/professional_profile.dart index 145477c..3efa1d0 100644 --- a/lib/src/screens/professional_profile.dart +++ b/lib/src/screens/professional_profile.dart @@ -312,18 +312,63 @@ class ProfessionalProfileScreenState extends State { } } + Future _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? images = await getPdfs(); + if (images != null) { + setState(() { + images_especializacion = images; + }); + } + Navigator.of(context).pop(); + }, + ), + ], + ), + ), + ); + }, + ); + } + + Future?> getPdfs() async { + FilePickerResult? result = await FilePicker.platform.pickFiles( + type: FileType.custom, + allowedExtensions: ['pdf'], + allowMultiple: true, + ); + + if (result != null) { + List files = result.files.map((file) => File(file.path!)).toList(); + return files; + } else { + return null; + } + } + Future> uploadEspecializaciones(List images) async { List 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 { 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),