Update 2026-04-17

This commit is contained in:
MAGESHWARAN 2026-04-17 10:24:14 +05:30
parent 96de59e9be
commit d1b4fb344e
6 changed files with 42 additions and 14 deletions

View File

@ -498,9 +498,18 @@ class DownloadHelper {
'pptx', 'pptx',
'rtf', 'rtf',
'odt', 'odt',
'rar',
'zip',
'7z',
].contains(ext); ].contains(ext);
} }
/// Check if file is an archive
static bool isArchiveFile(String path) {
final ext = getFileExtension(path);
return ['zip', 'rar', '7z', 'tar', 'gz'].contains(ext);
}
/// Check if file is video /// Check if file is video
static bool isVideoFile(String path) { static bool isVideoFile(String path) {
final ext = getFileExtension(path); final ext = getFileExtension(path);
@ -524,6 +533,7 @@ class DownloadHelper {
if (['doc', 'docx'].contains(ext)) return '📝'; if (['doc', 'docx'].contains(ext)) return '📝';
if (['xls', 'xlsx'].contains(ext)) return '📊'; if (['xls', 'xlsx'].contains(ext)) return '📊';
if (['ppt', 'pptx'].contains(ext)) return '📽️'; if (['ppt', 'pptx'].contains(ext)) return '📽️';
if (isArchiveFile(path)) return '📦';
} }
return '📎'; return '📎';
} }

View File

@ -229,6 +229,8 @@ class _ChatInputBoxState extends ConsumerState<ChatInputBox> {
return Icons.description; return Icons.description;
} else if (['xls', 'xlsx'].contains(ext)) { } else if (['xls', 'xlsx'].contains(ext)) {
return Icons.table_chart; return Icons.table_chart;
} else if (['zip', 'rar', '7z'].contains(ext)) {
return Icons.folder_zip;
} else { } else {
return Icons.insert_drive_file; return Icons.insert_drive_file;
} }

View File

@ -582,7 +582,11 @@ class SwipeableMessageBubbleState extends State<SwipeableMessageBubble>
child: Row( child: Row(
children: [ children: [
Icon( Icon(
Icons.insert_drive_file, ['xls', 'xlsx'].contains(doc.fileType.toLowerCase())
? Icons.table_chart
: ['zip', 'rar', '7z'].contains(doc.fileType.toLowerCase())
? Icons.folder_zip
: Icons.insert_drive_file,
color: Colors.grey[600], color: Colors.grey[600],
), ),
const SizedBox(width: 8), const SizedBox(width: 8),

View File

@ -142,14 +142,9 @@ class _ServiceRequestScreenState extends ConsumerState<ServiceRequestScreen> {
onTap: () => Navigator.pop(ctx, 'gallery'), onTap: () => Navigator.pop(ctx, 'gallery'),
), ),
ListTile( ListTile(
leading: const Icon(Icons.picture_as_pdf, color: Colors.red), leading: const Icon(Icons.insert_drive_file, color: Colors.blue),
title: const Text('Select PDF'), title: const Text('Files'),
onTap: () => Navigator.pop(ctx, 'pdf'), onTap: () => Navigator.pop(ctx, 'any'),
),
ListTile(
leading: const Icon(Icons.folder_zip, color: Colors.orange),
title: const Text('Select ZIP'),
onTap: () => Navigator.pop(ctx, 'zip'),
), ),
], ],
), ),
@ -183,11 +178,10 @@ class _ServiceRequestScreenState extends ConsumerState<ServiceRequestScreen> {
_isFileError = false; _isFileError = false;
}); });
} }
} else if (choice == 'pdf' || choice == 'zip') { } else if (choice == 'any') {
final result = await FilePicker.platform.pickFiles( final result = await FilePicker.platform.pickFiles(
allowMultiple: true, allowMultiple: true,
type: FileType.custom, type: FileType.any,
allowedExtensions: choice == 'pdf' ? ['pdf'] : ['zip', 'rar', '7z'],
); );
if (result != null && result.files.isNotEmpty) { if (result != null && result.files.isNotEmpty) {
for (var file in result.files) { for (var file in result.files) {
@ -284,6 +278,9 @@ class _ServiceRequestScreenState extends ConsumerState<ServiceRequestScreen> {
bool _isZip(String pathStr) => bool _isZip(String pathStr) =>
['.zip', '.rar', '.7z'].contains(path.extension(pathStr).toLowerCase()); ['.zip', '.rar', '.7z'].contains(path.extension(pathStr).toLowerCase());
bool _isExcel(String pathStr) =>
['.xls', '.xlsx'].contains(path.extension(pathStr).toLowerCase());
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final r = ResponsiveUtils(context); final r = ResponsiveUtils(context);
@ -418,6 +415,13 @@ class _ServiceRequestScreenState extends ConsumerState<ServiceRequestScreen> {
widget.icon, widget.icon,
width: serviceIconSize, width: serviceIconSize,
height: serviceIconSize, height: serviceIconSize,
errorBuilder: (context, error, stackTrace) {
return Icon(
Icons.error_outline,
color: Colors.red.shade300,
size: serviceIconSize * 0.8,
);
},
), ),
), ),
SizedBox(height: spacingMD), SizedBox(height: spacingMD),
@ -616,7 +620,7 @@ class _ServiceRequestScreenState extends ConsumerState<ServiceRequestScreen> {
child: Column( child: Column(
children: [ children: [
Text( Text(
"Upload PDF, IMG, JPG, ZIP", "Upload Documents or Images",
style: AppTextStyles.semiBold.copyWith( style: AppTextStyles.semiBold.copyWith(
fontSize: fontSize, fontSize: fontSize,
height: 25.56 / 12.78, height: 25.56 / 12.78,
@ -778,6 +782,13 @@ class _ServiceRequestScreenState extends ConsumerState<ServiceRequestScreen> {
size: iconSize, size: iconSize,
color: Colors.orange.shade600, color: Colors.orange.shade600,
); );
} else if (_isExcel(pathStr)) {
bgColor = Colors.green.shade50;
preview = Icon(
Icons.table_chart,
size: iconSize,
color: Colors.green.shade600,
);
} else { } else {
bgColor = Colors.blue.shade50; bgColor = Colors.blue.shade50;
preview = Icon( preview = Icon(

View File

@ -569,7 +569,7 @@ packages:
source: hosted source: hosted
version: "3.2.2" version: "3.2.2"
http_parser: http_parser:
dependency: transitive dependency: "direct main"
description: description:
name: http_parser name: http_parser
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"

View File

@ -40,6 +40,7 @@ dependencies:
web_socket_channel: ^3.0.2 web_socket_channel: ^3.0.2
flutter_local_notifications: ^18.0.1 flutter_local_notifications: ^18.0.1
curved_labeled_navigation_bar: ^2.0.6 curved_labeled_navigation_bar: ^2.0.6
http_parser: ^4.1.2