configuration method

void configuration(
  1. Config? config, {
  2. required dynamic onSelect(
    1. List<MediaFile>
    ),
  3. required Widget heroBuilder(
    1. String,
    2. MediaFile,
    3. BuildContext
    )?,
  4. required bool isRecent,
  5. required bool startWithRecent,
  6. required List<MediaFile>? initSelectedMedias,
  7. required List<MediaFile>? extraRecentMedia,
  8. required Widget multipleMediasBuilder(
    1. List<MediaFile>,
    2. BuildContext
    )?,
})

Implementation

void configuration(Config? config,
    {required dynamic Function(List<MediaFile>) onSelect,
    required Widget Function(String, MediaFile, BuildContext)? heroBuilder,
    required bool isRecent,
    required bool startWithRecent,
    required List<MediaFile>? initSelectedMedias,
    required List<MediaFile>? extraRecentMedia,
    required Widget Function(List<MediaFile>, BuildContext)?
        multipleMediasBuilder}) {
  this.onSelect = onSelect;
  this.heroBuilder = heroBuilder;
  this.isRecent = isRecent;
  this.startWithRecent = startWithRecent;
  this.multipleMediasBuilder = multipleMediasBuilder;
  pageController = PageController();
  pickerPageController = PageController(initialPage: startWithRecent ? 0 : 1);
  this.config = config ?? Config();
  if (initSelectedMedias != null) {
    _selectedFiles = initSelectedMedias.map((e) => e).toList();
  }
  if (extraRecentMedia != null) {
    _extraRecentMedia = extraRecentMedia.map((e) => e).toList();
  }
  if (selectedFiles.isNotEmpty) {
    _pickerMode = true;
  }
  configurationCompleted = true;
}