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
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final user = data['user'] as Map<String, dynamic>? ?? {};
|
||||
final userName =
|
||||
user['email'] as String? ?? user['name'] as String? ?? 'User';
|
||||
final avatar = user['avatar'] as String?;
|
||||
final userProfile = user['userProfile'] as Map<String, dynamic>? ?? {};
|
||||
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 avatar = (userProfile['avatar'] as String?) ??
|
||||
(user['avatar'] as String?);
|
||||
final message = data['message'] as String?;
|
||||
final requestId = data['id'] as String;
|
||||
final createdAt = data['createdAt'] as String?;
|
||||
@@ -449,10 +455,16 @@ class _ConnectionCardState extends ConsumerState<_ConnectionCard> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final user = widget.data['user'] as Map<String, dynamic>? ?? {};
|
||||
final userName =
|
||||
user['email'] as String? ?? user['name'] as String? ?? 'User';
|
||||
final userProfile = user['userProfile'] as Map<String, dynamic>? ?? {};
|
||||
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 avatar = user['avatar'] as String?;
|
||||
final avatar = (userProfile['avatar'] as String?) ??
|
||||
(user['avatar'] as String?);
|
||||
final respondedAt = widget.data['respondedAt'] as String?;
|
||||
final connectedDate = _formatConnectedDate(respondedAt);
|
||||
|
||||
|
||||
@@ -51,12 +51,8 @@ class _HeroSectionState extends ConsumerState<HeroSection> {
|
||||
if (_selectedCategory != null) params['category'] = Uri.encodeComponent(_selectedCategory!);
|
||||
|
||||
if (params.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Please select at least one filter to search'),
|
||||
backgroundColor: AppColors.accentOrange,
|
||||
),
|
||||
);
|
||||
// "All Types" with no other filters — navigate to show all agents
|
||||
context.push('/agents/search');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user