ComposePage.borrowed constructor

ComposePage.borrowed({
  1. required List<ComposeEntry> entries,
  2. Rect? initialSourceRect,
  3. Image? initialSnapshot,
  4. BorderRadius initialSourceRadius = BorderRadius.zero,
  5. GallerySource? transitionSourceFor(
    1. Object id
    )?,
  6. ComposeSubmitCallback? onSubmit,
  7. ComposePurpose purpose = ComposePurpose.mediaMessage,
  8. int? maxImageExtent,
})

Borrowed: reuses entries the caller (the picker) holds and holds each until dispose(), so an entry lives until both have left and per-asset state (crop / draw / caption / rendered preview) survives re-entry of compose during one picker session.

initialSourceRect / initialSnapshot (optional) drive the gallery-style open hero-flight from the picker thumbnail into the compose fit-rect. Close-time lookup is delegated to transitionSourceFor so the picker (which knows its visible view) returns the right cell — matches telegram's MediaPickerScreen.transitionView(for:). onSubmit fires before pop so the chat bubble(s) exist by the time the close hero captures its destination.

Implementation

ComposePage.borrowed({
  required List<ComposeEntry> entries,
  this.initialSourceRect,
  this.initialSnapshot,
  this.initialSourceRadius = BorderRadius.zero,
  this.transitionSourceFor,
  this.onSubmit,
  this.purpose = ComposePurpose.mediaMessage,
  this.maxImageExtent,
}) : assets = [for (final e in entries) e.input],
     _borrowedEntries = entries,
     ownsEntries = false {
  for (final e in entries) {
    e.retain();
  }
}