feat: Navigate directly to the agent search page when no filters are applied and prioritize user profile data for displaying user names and avatars.
This commit is contained in:
@@ -252,9 +252,15 @@ class _RequestCard extends ConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final user = data['user'] as Map<String, dynamic>? ?? {};
|
final user = data['user'] as Map<String, dynamic>? ?? {};
|
||||||
final userName =
|
final userProfile = user['userProfile'] as Map<String, dynamic>? ?? {};
|
||||||
user['email'] as String? ?? user['name'] as String? ?? 'User';
|
final profileFirstName = userProfile['firstName'] as String? ?? '';
|
||||||
final avatar = user['avatar'] as String?;
|
final profileLastName = userProfile['lastName'] as String? ?? '';
|
||||||
|
final profileName = '$profileFirstName $profileLastName'.trim();
|
||||||
|
final userName = profileName.isNotEmpty
|
||||||
|
? profileName
|
||||||
|
: (user['email'] as String? ?? 'User');
|
||||||
|
final avatar = (userProfile['avatar'] as String?) ??
|
||||||
|
(user['avatar'] as String?);
|
||||||
final message = data['message'] as String?;
|
final message = data['message'] as String?;
|
||||||
final requestId = data['id'] as String;
|
final requestId = data['id'] as String;
|
||||||
final createdAt = data['createdAt'] as String?;
|
final createdAt = data['createdAt'] as String?;
|
||||||
@@ -449,10 +455,16 @@ class _ConnectionCardState extends ConsumerState<_ConnectionCard> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final user = widget.data['user'] as Map<String, dynamic>? ?? {};
|
final user = widget.data['user'] as Map<String, dynamic>? ?? {};
|
||||||
final userName =
|
final userProfile = user['userProfile'] as Map<String, dynamic>? ?? {};
|
||||||
user['email'] as String? ?? user['name'] as String? ?? 'User';
|
final profileFirstName = userProfile['firstName'] as String? ?? '';
|
||||||
|
final profileLastName = userProfile['lastName'] as String? ?? '';
|
||||||
|
final profileName = '$profileFirstName $profileLastName'.trim();
|
||||||
|
final userName = profileName.isNotEmpty
|
||||||
|
? profileName
|
||||||
|
: (user['email'] as String? ?? 'User');
|
||||||
final userEmail = user['email'] as String? ?? '';
|
final userEmail = user['email'] as String? ?? '';
|
||||||
final avatar = user['avatar'] as String?;
|
final avatar = (userProfile['avatar'] as String?) ??
|
||||||
|
(user['avatar'] as String?);
|
||||||
final respondedAt = widget.data['respondedAt'] as String?;
|
final respondedAt = widget.data['respondedAt'] as String?;
|
||||||
final connectedDate = _formatConnectedDate(respondedAt);
|
final connectedDate = _formatConnectedDate(respondedAt);
|
||||||
|
|
||||||
|
|||||||
@@ -51,12 +51,8 @@ class _HeroSectionState extends ConsumerState<HeroSection> {
|
|||||||
if (_selectedCategory != null) params['category'] = Uri.encodeComponent(_selectedCategory!);
|
if (_selectedCategory != null) params['category'] = Uri.encodeComponent(_selectedCategory!);
|
||||||
|
|
||||||
if (params.isEmpty) {
|
if (params.isEmpty) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
// "All Types" with no other filters — navigate to show all agents
|
||||||
const SnackBar(
|
context.push('/agents/search');
|
||||||
content: Text('Please select at least one filter to search'),
|
|
||||||
backgroundColor: AppColors.accentOrange,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user