payfrit-app/lib/models/user_profile.dart
John Mizerek 2491c961e0 Add address management and user account features
- Add delivery address list, add, edit, delete, set default functionality
- Add order history screen
- Add profile settings screen
- Add account screen with avatar upload
- Update restaurant select gradient direction
- Add states API endpoint for address forms
- Fix table names (tt_States)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 20:22:37 -08:00

36 lines
918 B
Dart

class UserProfile {
final int userId;
final String firstName;
final String lastName;
final String email;
final String phone;
const UserProfile({
required this.userId,
required this.firstName,
required this.lastName,
required this.email,
required this.phone,
});
factory UserProfile.fromJson(Map<String, dynamic> json) {
return UserProfile(
userId: (json["UserID"] as num).toInt(),
firstName: json["FirstName"] as String? ?? "",
lastName: json["LastName"] as String? ?? "",
email: json["Email"] as String? ?? "",
phone: json["Phone"] as String? ?? "",
);
}
String get displayName {
if (firstName.isNotEmpty && lastName.isNotEmpty) {
return "$firstName $lastName";
} else if (firstName.isNotEmpty) {
return firstName;
} else if (lastName.isNotEmpty) {
return lastName;
}
return "User #$userId";
}
}