cedula y certificado
This commit is contained in:
@@ -132,7 +132,7 @@ class _DrawerProfessionalState extends State<DrawerProfessional> {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return MyServicesProScreen();
|
||||
return const MyServicesProScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -226,7 +226,7 @@ class _DrawerProfessionalState extends State<DrawerProfessional> {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return MessagesScreen();
|
||||
return const MessagesScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -304,14 +304,11 @@ class _DrawerProfessionalState extends State<DrawerProfessional> {
|
||||
color: Colors.white,
|
||||
child: ListTile(
|
||||
onTap: () async {
|
||||
var professional =
|
||||
await Professional.getProfessional(uid!);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ReputationProScreen();
|
||||
return const ReputationProScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:firebase_storage/firebase_storage.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/components/photo_view.dart';
|
||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/controllers/info_%20professional.dart';
|
||||
import 'package:prosappco/src/services/select_image_profile.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
|
||||
class ProfessionalProfileScreen extends StatefulWidget {
|
||||
const ProfessionalProfileScreen({super.key});
|
||||
@@ -62,6 +62,20 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<File?> getPdf() async {
|
||||
FilePickerResult? result = await FilePicker.platform.pickFiles(
|
||||
type: FileType.custom,
|
||||
allowedExtensions: ['pdf'],
|
||||
);
|
||||
|
||||
if (result != null) {
|
||||
File file = File(result.files.single.path!);
|
||||
return file;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showChoiceDialog(BuildContext context) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
@@ -115,21 +129,6 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
||||
content: SingleChildScrollView(
|
||||
child: ListBody(
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: const Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Tomar foto",
|
||||
style: TextStyle(color: Color(0xFF2BA4EC)),
|
||||
),
|
||||
onTap: () async {
|
||||
final imagen = await getImage(1);
|
||||
setState(() {
|
||||
image_cedula = File(imagen[0]!.path);
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
const Divider(color: Colors.black54),
|
||||
GestureDetector(
|
||||
child: const Text(
|
||||
textAlign: TextAlign.center,
|
||||
@@ -137,9 +136,9 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
||||
style: TextStyle(color: Color(0xFF2BA4EC)),
|
||||
),
|
||||
onTap: () async {
|
||||
final imagen = await getImage(2);
|
||||
final imagen = await getPdf();
|
||||
setState(() {
|
||||
image_cedula = File(imagen[0]!.path);
|
||||
image_cedula = File(imagen!.path);
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
@@ -160,21 +159,6 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
||||
content: SingleChildScrollView(
|
||||
child: ListBody(
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: const Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Tomar foto",
|
||||
style: TextStyle(color: Color(0xFF2BA4EC)),
|
||||
),
|
||||
onTap: () async {
|
||||
final imagen = await getImage(1);
|
||||
setState(() {
|
||||
image_certificado = File(imagen[0]!.path);
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
const Divider(color: Colors.black54),
|
||||
GestureDetector(
|
||||
child: const Text(
|
||||
textAlign: TextAlign.center,
|
||||
@@ -182,9 +166,9 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
||||
style: TextStyle(color: Color(0xFF2BA4EC)),
|
||||
),
|
||||
onTap: () async {
|
||||
final imagen = await getImage(2);
|
||||
final imagen = await getPdf();
|
||||
setState(() {
|
||||
image_certificado = File(imagen[0]!.path);
|
||||
image_certificado = File(imagen!.path);
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
@@ -198,14 +182,13 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
||||
}
|
||||
|
||||
Future<bool> uploadCedula(File image) async {
|
||||
final String namefile = image.path.split('/').last;
|
||||
final now = DateTime.now();
|
||||
final formattedDate = DateFormat('HHmmssddMMyyyy').format(now);
|
||||
final milliseconds = (now.microsecondsSinceEpoch / 1000).round();
|
||||
final random = 'c$formattedDate$milliseconds';
|
||||
|
||||
Reference ref = storage
|
||||
.ref()
|
||||
.child('users')
|
||||
.child(uid!)
|
||||
.child('cedula')
|
||||
.child(namefile);
|
||||
Reference ref =
|
||||
storage.ref().child('users').child(uid!).child('cedula').child(random);
|
||||
|
||||
final UploadTask uploadTask = ref.putFile(image);
|
||||
|
||||
@@ -240,14 +223,17 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
||||
}
|
||||
|
||||
Future<bool> uploadCertificado(File image) async {
|
||||
final String namefile = image.path.split('/').last;
|
||||
final now = DateTime.now();
|
||||
final formattedDate = DateFormat('HHmmssddMMyyyy').format(now);
|
||||
final milliseconds = (now.microsecondsSinceEpoch / 1000).round();
|
||||
final random = 'f$formattedDate$milliseconds';
|
||||
|
||||
Reference ref = storage
|
||||
.ref()
|
||||
.child('users')
|
||||
.child(uid!)
|
||||
.child('certificado_profesional')
|
||||
.child(namefile);
|
||||
.child(random);
|
||||
|
||||
final UploadTask uploadTask = ref.putFile(image);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user