import 'package:file_picker/file_picker.dart'; import 'image_manager.dart'; class FileHandler { /// Open file picker dialog and load images static Future openFileDialog() async { final result = await FilePicker.platform.pickFiles( type: FileType.custom, allowedExtensions: ['png', 'jpg', 'jpeg', 'jfif', 'jpe', 'webp', 'bmp', 'gif', 'wbmp'], allowMultiple: true, ); if (result != null && result.files.isNotEmpty) { final paths = result.files .where((f) => f.path != null) .map((f) => f.path!) .toList(); ImageManager.instance.setGalleryFromPaths(paths); } } /// Load images from given file paths static void loadImagesFromPaths(List paths) { if (paths.isNotEmpty) { ImageManager.instance.setGalleryFromPaths(paths); } } }