vistas de ciudadano, escalar animaciones de mascota, implementacion de chatbot para concientizacion, modificacion de datos de ciudadano, modificacion de vista principal

This commit is contained in:
shinra32
2026-05-23 05:03:05 -06:00
parent 89dcc6250b
commit ca076607c7
39 changed files with 2909 additions and 560 deletions

View File

@@ -0,0 +1,43 @@
class ProfileUser {
final String id;
final String? email;
final String? phone;
final String? name;
final String role;
final String? createdAt;
const ProfileUser({
required this.id,
this.email,
this.phone,
this.name,
required this.role,
this.createdAt,
});
factory ProfileUser.fromJson(Map<String, dynamic> json) => ProfileUser(
id: json['id'] as String,
email: json['email'] as String?,
phone: json['phone'] as String?,
name: json['name'] as String?,
role: (json['role'] as String?) ?? 'citizen',
createdAt: json['created_at'] as String?,
);
bool get isAdmin => role == 'admin';
bool get isDriver => role == 'driver';
String get displayName {
if (name != null && name!.trim().isNotEmpty) return name!.trim();
if (email != null && email!.isNotEmpty) return email!;
return 'Usuario';
}
String get initials {
final source = (name != null && name!.trim().isNotEmpty)
? name!.trim()
: (email ?? '');
if (source.isEmpty) return 'U';
return source[0].toUpperCase();
}
}