refactor: update contact email and phone priority logic in agent detail provider to match web implementation
This commit is contained in:
@@ -245,20 +245,29 @@ class AgentDetailState {
|
|||||||
|
|
||||||
// ── Contact info (masked) ──
|
// ── Contact info (masked) ──
|
||||||
|
|
||||||
|
/// Contact email — matches web priority: agentProfile.email first,
|
||||||
|
/// then user login email, then dynamic field values as fallback.
|
||||||
String? get contactEmail {
|
String? get contactEmail {
|
||||||
final val = _getFieldValue('email') ??
|
final profileEmail = agent?.email;
|
||||||
_getFieldValue('email_address') ??
|
if (profileEmail != null && profileEmail.isNotEmpty) return profileEmail;
|
||||||
agent?.email ??
|
|
||||||
agent?.user?.email;
|
final userEmail = agent?.user?.email;
|
||||||
|
if (userEmail != null && userEmail.isNotEmpty) return userEmail;
|
||||||
|
|
||||||
|
final val = _getFieldValue('email') ?? _getFieldValue('email_address');
|
||||||
return val?.toString();
|
return val?.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Contact phone — matches web priority: agentProfile.phone first,
|
||||||
|
/// then dynamic field values as fallback.
|
||||||
String? get contactPhone {
|
String? get contactPhone {
|
||||||
|
final profilePhone = agent?.phone;
|
||||||
|
if (profilePhone != null && profilePhone.isNotEmpty) return profilePhone;
|
||||||
|
|
||||||
final val = _getFieldValue('phone_number') ??
|
final val = _getFieldValue('phone_number') ??
|
||||||
_getFieldValue('phone') ??
|
_getFieldValue('phone') ??
|
||||||
_getFieldValue('cell_number') ??
|
_getFieldValue('cell_number') ??
|
||||||
_getFieldValue('office_number') ??
|
_getFieldValue('office_number');
|
||||||
agent?.phone;
|
|
||||||
return val?.toString();
|
return val?.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user