import 'package:file_picker/file_picker.dart';
import 'package:image_picker/image_picker.dart';

class FilePick {
  static final _picker = ImagePicker();

  static Future<List<XFile>?> multipleGalleryPick() async {
    final pickedImages = await _picker.pickMultiImage();
    return pickedImages.isNotEmpty ? pickedImages : null;
  }

  static Future<XFile?> singleGalleryPick() =>
      _picker.pickImage(source: ImageSource.gallery);

  static Future<XFile?> cameraPick() =>
      _picker.pickImage(source: ImageSource.camera);

  static Future<List<String>?> documentPick() async {
    final result = await FilePicker.pickFiles(allowMultiple: true);
    return result?.files.map((e) => e.path).nonNulls.toList();
  }
}
