TogeFileUploadWidget constructor

const TogeFileUploadWidget({
  1. Key? key,
  2. required String uploadTitle,
  3. String? systemTrayTitle,
  4. List<TogeFileUploadSource>? sources,
  5. String? title,
  6. Widget? uploadIconWidget,
  7. int maxFileSizeInMB = 5,
  8. String? errorMessageBuilder(
    1. File file,
    2. bool isValidSize,
    3. bool isValidFileType
    )?,
  9. int maxUpload = 1,
  10. bool isModalDismissible = true,
  11. String? subLabelOne,
  12. String? subLabelTwo,
  13. List<TogeFileUploadFileType>? allowedFileTypes,
  14. bool allowDuplicateFiles = false,
  15. void onFilesChanged(
    1. List<TogeFileUploadEntity> files
    )?,
  16. void onFileAdded(
    1. TogeFileUploadEntity file
    )?,
  17. void onFileRemoved(
    1. TogeFileUploadEntity file
    )?,
  18. void onFileReplaced(
    1. TogeFileUploadEntity oldFile,
    2. TogeFileUploadEntity newFile
    )?,
  19. void onReplaceTap(
    1. int index,
    2. TogeFileUploadSource source
    )?,
  20. Future<bool> onUploadTap()?,
  21. List<TogeFileUploadEntity>? initialFiles,
  22. String? takePhotoLabel,
  23. String? photoGalleryLabel,
  24. String? fileStorageLabel,
  25. String? replaceFileLabel,
  26. bool viewOnly = false,
})

Implementation

const TogeFileUploadWidget({
  super.key,
  required this.uploadTitle,
  this.systemTrayTitle,
  this.sources,
  this.title,
  this.uploadIconWidget,
  this.maxFileSizeInMB = 5,
  this.errorMessageBuilder,
  this.maxUpload = 1,
  this.isModalDismissible = true,
  this.subLabelOne,
  this.subLabelTwo,
  this.allowedFileTypes,
  this.allowDuplicateFiles = false,
  this.onFilesChanged,
  this.onFileAdded,
  this.onFileRemoved,
  this.onFileReplaced,
  this.onReplaceTap,
  this.onUploadTap,
  this.initialFiles,
  this.takePhotoLabel,
  this.photoGalleryLabel,
  this.fileStorageLabel,
  this.replaceFileLabel,
  this.viewOnly = false,
}) : assert(
        maxFileSizeInMB > 0,
        'Max file size must be greater than 0',
      );