update y componente drawer

This commit is contained in:
Juan Felipe Duarte
2023-04-11 15:59:11 -05:00
parent 33d7da756f
commit 716ad80f1d
5 changed files with 314 additions and 457 deletions
+15 -203
View File
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'dart:io';
import 'package:prosappco/src/authentication/authentication_repository.dart';
import 'package:prosappco/src/components/drawer_menu.dart';
import 'package:prosappco/src/controllers/add_name_email_city.dart';
import 'package:prosappco/src/services/select_image_profile.dart';
@@ -223,6 +224,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
return;
}
if (newEmail.isEmpty) {
// Si el nuevo nombre está vacío, no lo actualizamos y mostramos un mensaje al usuario
ScaffoldMessenger.of(context).showSnackBar(
@@ -303,6 +305,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
setState(() {
imagen_to_upload = File(imagen[0]!.path);
});
Navigator.of(context).pop();
},
),
Divider(color: Colors.black54),
@@ -317,6 +320,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
setState(() {
imagen_to_upload = File(imagen[0]!.path);
});
Navigator.of(context).pop();
},
),
],
@@ -349,206 +353,12 @@ class _ProfileScreenState extends State<ProfileScreen> {
),
),
),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
Column(
children: [
Column(
children: [
Builder(builder: (context) {
return ListTile(
onTap: () {
Scaffold.of(context).openEndDrawer();
},
title: Text(user?.displayName ?? '',
style:
const TextStyle(fontWeight: FontWeight.bold)),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
user?.phoneNumber ?? '',
style: const TextStyle(fontSize: 12),
),
Text(
city,
style: const 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),
Column(
children: [
ListTile(
onTap: () {},
leading: Icon(
Icons.history,
color: Colors.black,
),
title: Text(
'Mis servicios',
style: TextStyle(fontSize: 15),
),
),
Builder(builder: (context) {
return ListTile(
onTap: () {
Scaffold.of(context).openEndDrawer();
},
leading: Icon(
Icons.person_outline,
color: Colors.black,
),
title: Text(
'Mi perfil',
style: TextStyle(fontSize: 15),
),
);
}),
ListTile(
onTap: () {},
leading: Icon(
Icons.construction_outlined,
color: Colors.black,
),
title: Text(
'Configuración',
style: TextStyle(fontSize: 15),
),
),
ListTile(
onTap: () {},
leading: Icon(
Icons.question_mark_rounded,
color: Colors.black,
),
title: Text(
'Soporte',
style: TextStyle(fontSize: 15),
),
),
ListTile(
onTap: () {},
leading: Icon(
Icons.messenger_outline,
color: Colors.black,
),
title: Text(
'Mensajes',
style: TextStyle(fontSize: 15),
),
),
ListTile(
onTap: () {
Navigator.pushReplacementNamed(context, '/welcome');
},
trailing: Icon(
Icons.keyboard_arrow_right,
color: Colors.white,
),
title: Text(
'Solicitar servicio',
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold),
),
tileColor: Color(0xFF2BA4EC),
contentPadding:
EdgeInsets.symmetric(vertical: 5, horizontal: 16),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Prosapp',
style: TextStyle(fontSize: 10, color: Colors.grey[700]),
),
Padding(
padding:
const EdgeInsets.only(top: 7, left: 3, right: 3),
child: Text(
'®',
style:
TextStyle(fontSize: 25, color: Colors.grey[700]),
),
),
Text(
'todos los derechos reservados',
style: TextStyle(fontSize: 10, color: Colors.grey[700]),
),
],
),
],
),
Padding(
padding: const EdgeInsets.only(top: 200),
child: Row(
children: [
SizedBox(width: 10),
ElevatedButton(
onPressed: () {
AuthenticationRepository.instance.logout();
},
child: Icon(
Icons.logout_outlined,
color: Colors.red,
size: 35,
),
style: ElevatedButton.styleFrom(
primary: Colors.white,
shape: CircleBorder(),
elevation: 3,
minimumSize: Size(45, 45),
),
),
SizedBox(width: 5),
ElevatedButton(
onPressed: () {
if (state == 'pendiente') {
Navigator.pushNamed(context, '/profesionalProfile');
} else if (state == 'revision') {
Navigator.pushNamed(context, '/profesionalRevision');
}
},
child: Text(
'Modo profesional',
style: TextStyle(
color: Colors.white,
fontSize: 15,
),
),
style: ElevatedButton.styleFrom(
primary: Color(0xFF2BA4EC),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
),
elevation: 0,
minimumSize: Size(200, 45),
),
),
],
),
),
],
),
),
drawer: DrawerMenu(
ref: storage.ref().child(_photo),
userName: user?.displayName ?? '',
userPhoneNumber: user?.phoneNumber ?? '',
userCity: city,
userState: state),
body: Center(
child: Column(
children: [
@@ -562,7 +372,9 @@ class _ProfileScreenState extends State<ProfileScreen> {
? LocalPhoto(
file: imagen_to_upload!,
)
: ReferencePhoto(ref: storage.ref().child(_photo))),
: ReferencePhoto(
ref: storage.ref().child(_photo),
)),
),
Container(
width: 300,
@@ -575,7 +387,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
controller: _nameController,
decoration: InputDecoration(
prefixIcon: Icon(Icons.person_outline),
hintText: 'Nombre'),
hintText: 'Nombre (Obligatorio)'),
),
SizedBox(
height:
@@ -585,7 +397,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
controller: _emailController,
decoration: InputDecoration(
prefixIcon: Icon(Icons.email_outlined),
hintText: 'Email'),
hintText: 'Email (Obligatorio)'),
),
SizedBox(
height: