|  |  |  | @ -8,6 +8,8 @@ import 'package:mohem_flutter_app/classes/colors.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/extensions/string_extensions.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/widgets/bottom_sheets/attachment_options.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:permission_handler/permission_handler.dart'; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | class ImageOptions { | 
		
	
		
			
				|  |  |  |  |   static void showImageOptionsNew(BuildContext context, bool showFilesOption, Function(String, File) image) { | 
		
	
	
		
			
				
					|  |  |  | @ -43,24 +45,42 @@ class ImageOptions { | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |         }, | 
		
	
		
			
				|  |  |  |  |         onFilesTap: () async { | 
		
	
		
			
				|  |  |  |  |           FilePickerResult? result = await FilePicker.platform.pickFiles( | 
		
	
		
			
				|  |  |  |  |             type: FileType.custom, | 
		
	
		
			
				|  |  |  |  |             allowedExtensions: [ | 
		
	
		
			
				|  |  |  |  |               'jpg', | 
		
	
		
			
				|  |  |  |  |               'jpeg ', | 
		
	
		
			
				|  |  |  |  |               'pdf', | 
		
	
		
			
				|  |  |  |  |               'txt', | 
		
	
		
			
				|  |  |  |  |               'docx', | 
		
	
		
			
				|  |  |  |  |               'doc', | 
		
	
		
			
				|  |  |  |  |               'pptx', | 
		
	
		
			
				|  |  |  |  |               'xlsx', | 
		
	
		
			
				|  |  |  |  |               'png', | 
		
	
		
			
				|  |  |  |  |               'rar', | 
		
	
		
			
				|  |  |  |  |               'zip', | 
		
	
		
			
				|  |  |  |  |             ], | 
		
	
		
			
				|  |  |  |  |           ); | 
		
	
		
			
				|  |  |  |  |           List<File> files = result!.paths.map((path) => File(path!)).toList(); | 
		
	
		
			
				|  |  |  |  |           image(result.files.first.path.toString(), files.first); | 
		
	
		
			
				|  |  |  |  |           Permission.storage.isGranted.then((isGranted) { | 
		
	
		
			
				|  |  |  |  |             if (!isGranted) { | 
		
	
		
			
				|  |  |  |  |               Permission.manageExternalStorage.request().then((granted) async { | 
		
	
		
			
				|  |  |  |  |                 if (granted == PermissionStatus.granted) { | 
		
	
		
			
				|  |  |  |  |                   FilePickerResult? result = await FilePicker.platform.pickFiles( | 
		
	
		
			
				|  |  |  |  |                     type: FileType.custom, | 
		
	
		
			
				|  |  |  |  |                     allowedExtensions: [ | 
		
	
		
			
				|  |  |  |  |                       'jpg', | 
		
	
		
			
				|  |  |  |  |                       'jpeg ', | 
		
	
		
			
				|  |  |  |  |                       'pdf', | 
		
	
		
			
				|  |  |  |  |                       'txt', | 
		
	
		
			
				|  |  |  |  |                       'docx', | 
		
	
		
			
				|  |  |  |  |                       'doc', | 
		
	
		
			
				|  |  |  |  |                       'pptx', | 
		
	
		
			
				|  |  |  |  |                       'xlsx', | 
		
	
		
			
				|  |  |  |  |                       'png', | 
		
	
		
			
				|  |  |  |  |                       'rar', | 
		
	
		
			
				|  |  |  |  |                       'zip', | 
		
	
		
			
				|  |  |  |  |                     ], | 
		
	
		
			
				|  |  |  |  |                   ); | 
		
	
		
			
				|  |  |  |  |                   List<File> files = result!.paths.map((path) => File(path!)).toList(); | 
		
	
		
			
				|  |  |  |  |                   image(result.files.first.path.toString(), files.first); | 
		
	
		
			
				|  |  |  |  |                 } else { | 
		
	
		
			
				|  |  |  |  |                   showDialog( | 
		
	
		
			
				|  |  |  |  |                     context: context, | 
		
	
		
			
				|  |  |  |  |                     builder: (BuildContext cxt) => ConfirmDialog( | 
		
	
		
			
				|  |  |  |  |                       message: "You need to give storage permission to upload files.", | 
		
	
		
			
				|  |  |  |  |                       onTap: () { | 
		
	
		
			
				|  |  |  |  |                         Navigator.pop(context); | 
		
	
		
			
				|  |  |  |  |                       }, | 
		
	
		
			
				|  |  |  |  |                     ), | 
		
	
		
			
				|  |  |  |  |                   ); | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
		
			
				|  |  |  |  |               }); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |           }); | 
		
	
		
			
				|  |  |  |  |         }, | 
		
	
		
			
				|  |  |  |  |       ), | 
		
	
		
			
				|  |  |  |  |     ); | 
		
	
	
		
			
				
					|  |  |  | 
 |