imagen
This commit is contained in:
@@ -9,6 +9,8 @@ import 'package:prosappco/src/controllers/add_name_email_city.dart';
|
||||
import 'package:prosappco/src/services/select_image_profile.dart';
|
||||
import 'package:prosappco/src/services/upload_image.dart';
|
||||
|
||||
import '../components/photo_view.dart';
|
||||
|
||||
class ProfileScreen extends StatefulWidget {
|
||||
ProfileScreen({Key? key}) : super(key: key);
|
||||
|
||||
@@ -271,6 +273,15 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget prueba() {
|
||||
try {
|
||||
return ReferencePhoto(ref: null);
|
||||
} catch (e) {
|
||||
print('errrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrror $e');
|
||||
return Center();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showChoiceDialog(BuildContext context) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
@@ -343,60 +354,36 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
child: Builder(builder: (context) {
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
Scaffold.of(context).openEndDrawer();
|
||||
},
|
||||
title: Text('${user?.displayName}',
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${user?.phoneNumber}',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
'$city',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
leading: FutureBuilder<Widget>(
|
||||
future:
|
||||
downloadImage(storage.ref().child(_photo)),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Widget> snapshot) {
|
||||
if (snapshot.connectionState ==
|
||||
ConnectionState.done &&
|
||||
snapshot.hasData) {
|
||||
return snapshot.data!;
|
||||
} else {
|
||||
return Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF2BA4EC),
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.person,
|
||||
color: Colors.white,
|
||||
size: 55,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
trailing: Icon(Icons.keyboard_arrow_right,
|
||||
color: Colors.black),
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 20, horizontal: 16),
|
||||
);
|
||||
}),
|
||||
),
|
||||
Builder(builder: (context) {
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
Scaffold.of(context).openEndDrawer();
|
||||
},
|
||||
title: Text('${user?.displayName}',
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${user?.phoneNumber}',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
'$city',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
leading: ReferencePhoto(
|
||||
ref: storage.ref().child(_photo),
|
||||
size: 50,
|
||||
),
|
||||
trailing: Icon(Icons.keyboard_arrow_right,
|
||||
color: Colors.black),
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 20, horizontal: 16),
|
||||
);
|
||||
}),
|
||||
], // padding: const EdgeInsets.only(top: 20, bottom: 15),
|
||||
),
|
||||
Divider(height: 0, color: Colors.grey),
|
||||
@@ -555,38 +542,21 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
body: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
imagen_to_upload != null
|
||||
? GestureDetector(
|
||||
onTap: () {
|
||||
_showChoiceDialog(context);
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 50),
|
||||
child: ClipOval(
|
||||
child: Image.file(
|
||||
imagen_to_upload!,
|
||||
width: 100,
|
||||
height: 100,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: FutureBuilder<Widget>(
|
||||
future: downloadImage(storage.ref().child(_photo)),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Widget> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done &&
|
||||
snapshot.hasData) {
|
||||
return snapshot.data!;
|
||||
} else {
|
||||
return const CircularProgressIndicator();
|
||||
}
|
||||
},
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
_showChoiceDialog(context);
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 50),
|
||||
child: (imagen_to_upload != null)
|
||||
? LocalPhoto(
|
||||
file: imagen_to_upload!,
|
||||
)
|
||||
: ReferencePhoto(ref: storage.ref().child(_photo))),
|
||||
),
|
||||
Container(
|
||||
width: 300,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
padding: const EdgeInsets.only(top: 0),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
|
||||
Reference in New Issue
Block a user