cb_prestige_qr/lib/features/auth/domain/entities/user_profile.dart
2026-04-27 15:38:26 +06:30

26 lines
668 B
Dart

class UserProfile {
const UserProfile({
required this.username,
required this.displayName,
required this.roleLabel,
required this.branchLabel,
});
final String username;
final String displayName;
final String roleLabel;
final String branchLabel;
String get initials {
final parts = displayName
.trim()
.split(RegExp(r'\s+'))
.where((part) => part.isNotEmpty)
.toList(growable: false);
if (parts.isEmpty) return 'U';
if (parts.length == 1) return parts.first.substring(0, 1).toUpperCase();
return '${parts.first.substring(0, 1)}${parts.last.substring(0, 1)}'
.toUpperCase();
}
}