Co-authored-by: eddgranados12 <eddgranados12@users.noreply.github.com>
Co-authored-by: MENDOZA BALLARDO GAEL RICARDO <gael-meb123@users.noreply.github.com> Co-authored-by: Azareth-Tr <Azareth-Tr@users.noreply.github.com> modificacion de las vistas principales para el usuario ciudadano, primer avance para el panel admin
This commit is contained in:
@@ -22,7 +22,8 @@ class ProfileScreen extends ConsumerWidget {
|
||||
body: FutureBuilder<_ProfileData>(
|
||||
future: _loadProfile(storage),
|
||||
builder: (context, snapshot) {
|
||||
final profile = snapshot.data ??
|
||||
final profile =
|
||||
snapshot.data ??
|
||||
_ProfileData(
|
||||
email: authState?.token != null ? '…' : '',
|
||||
role: authState?.userRole ?? 'citizen',
|
||||
@@ -39,7 +40,7 @@ class ProfileScreen extends ConsumerWidget {
|
||||
icon: Icons.person_outline,
|
||||
title: 'Editar perfil',
|
||||
subtitle: profile.email,
|
||||
onTap: () {},
|
||||
onTap: () => context.go('/edit-profile'),
|
||||
),
|
||||
AppMenuTile(
|
||||
icon: Icons.lock_outline,
|
||||
@@ -110,7 +111,10 @@ class ProfileScreen extends ConsumerWidget {
|
||||
'Recolecta v1.0.0\nServicio de Limpia · Celaya, Gto.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12, color: AppTheme.textHint, height: 1.6),
|
||||
fontSize: 12,
|
||||
color: AppTheme.textHint,
|
||||
height: 1.6,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
@@ -133,19 +137,26 @@ class ProfileScreen extends ConsumerWidget {
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: AppTheme.surface,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppTheme.radiusLg)),
|
||||
title: const Text('Cerrar sesión',
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppTheme.textPrimary)),
|
||||
content: const Text('¿Estás seguro de que deseas cerrar sesión?',
|
||||
style: TextStyle(fontSize: 14, color: AppTheme.textSecondary)),
|
||||
borderRadius: BorderRadius.circular(AppTheme.radiusLg),
|
||||
),
|
||||
title: const Text(
|
||||
'Cerrar sesión',
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppTheme.textPrimary,
|
||||
),
|
||||
),
|
||||
content: const Text(
|
||||
'¿Estás seguro de que deseas cerrar sesión?',
|
||||
style: TextStyle(fontSize: 14, color: AppTheme.textSecondary),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: AppTheme.textSecondary),
|
||||
foregroundColor: AppTheme.textSecondary,
|
||||
),
|
||||
child: const Text('Cancelar'),
|
||||
),
|
||||
TextButton(
|
||||
@@ -155,8 +166,10 @@ class ProfileScreen extends ConsumerWidget {
|
||||
if (context.mounted) context.go('/login');
|
||||
},
|
||||
style: TextButton.styleFrom(foregroundColor: AppTheme.danger),
|
||||
child: const Text('Cerrar sesión',
|
||||
style: TextStyle(fontWeight: FontWeight.w600)),
|
||||
child: const Text(
|
||||
'Cerrar sesión',
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -169,13 +182,9 @@ class _ProfileData {
|
||||
final String email;
|
||||
final String role;
|
||||
|
||||
const _ProfileData({
|
||||
this.email = '',
|
||||
this.role = 'citizen',
|
||||
});
|
||||
const _ProfileData({this.email = '', this.role = 'citizen'});
|
||||
|
||||
String get iniciales =>
|
||||
email.isNotEmpty ? email[0].toUpperCase() : 'U';
|
||||
String get iniciales => email.isNotEmpty ? email[0].toUpperCase() : 'U';
|
||||
|
||||
String get displayName => email;
|
||||
bool get isAdmin => role == 'admin';
|
||||
@@ -210,9 +219,10 @@ class _ProfileHeader extends StatelessWidget {
|
||||
child: Text(
|
||||
profile.iniciales,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppTheme.primaryDark),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppTheme.primaryDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -221,18 +231,26 @@ class _ProfileHeader extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(profile.displayName,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppTheme.textPrimary)),
|
||||
Text(
|
||||
profile.displayName,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppTheme.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(profile.email,
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.textSecondary)),
|
||||
Text(
|
||||
profile.email,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppTheme.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
AppStatusBadge.green(
|
||||
profile.isAdmin ? 'Administrador' : 'Ciudadano'),
|
||||
profile.isAdmin ? 'Administrador' : 'Ciudadano',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user