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',
'rtf',
'odt',
'rar',
'zip',
'7z',
].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
static bool isVideoFile(String path) {
final ext = getFileExtension(path);
@ -524,6 +533,7 @@ class DownloadHelper {
if (['doc', 'docx'].contains(ext)) return '📝';
if (['xls', 'xlsx'].contains(ext)) return '📊';
if (['ppt', 'pptx'].contains(ext)) return '📽️';
if (isArchiveFile(path)) return '📦';
}
return '📎';
}

View File

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

View File

@ -582,7 +582,11 @@ class SwipeableMessageBubbleState extends State<SwipeableMessageBubble>
child: Row(
children: [
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],
),
const SizedBox(width: 8),

View File

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

View File

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

View File

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