feat: Support WebP image uploads, correct JPG MIME type, and refine professional rating display logic.

This commit is contained in:
pradeepkumar
2026-03-18 12:32:41 +05:30
parent 2c657e77f2
commit cde137e07b
2 changed files with 6 additions and 4 deletions

View File

@@ -290,7 +290,8 @@ class _TopProfessionalsSectionState
final experience = agent.experienceText; final experience = agent.experienceText;
final locationText = agent.location; final locationText = agent.location;
final subtitle = agent.agentType != null ? '(${agent.agentType!.name})' : ''; final subtitle = agent.agentType != null ? '(${agent.agentType!.name})' : '';
final rating = agent.averageRating ?? 5.0; final rawRating = agent.averageRating ?? 0.0;
final rating = rawRating > 0 ? rawRating : 5.0;
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(

View File

@@ -278,8 +278,8 @@ class _ProfileSettingsTabState extends ConsumerState<ProfileSettingsTab> {
if (picked == null) return; if (picked == null) return;
final ext = picked.path.split('.').last.toLowerCase(); final ext = picked.path.split('.').last.toLowerCase();
if (!['jpg', 'jpeg', 'png', 'gif'].contains(ext)) { if (!['jpg', 'jpeg', 'png', 'webp'].contains(ext)) {
if (mounted) _showSnackBar('Please select a JPEG, PNG, or GIF image', isError: true); if (mounted) _showSnackBar('Please select a JPEG, PNG, or WebP image', isError: true);
return; return;
} }
@@ -297,7 +297,8 @@ class _ProfileSettingsTabState extends ConsumerState<ProfileSettingsTab> {
try { try {
final profileState = ref.read(profileProvider); final profileState = ref.read(profileProvider);
final role = profileState.isAgent ? 'AGENT' : 'USER'; final role = profileState.isAgent ? 'AGENT' : 'USER';
final contentType = 'image/$ext'; final mimeExt = ext == 'jpg' ? 'jpeg' : ext;
final contentType = 'image/$mimeExt';
final fileName = picked.name; final fileName = picked.name;
final repo = ProfileRepository(); final repo = ProfileRepository();