ComposePage.borrowed constructor
ComposePage.borrowed({
- required List<
ComposeEntry> entries, - Rect? initialSourceRect,
- Image? initialSnapshot,
- BorderRadius initialSourceRadius = BorderRadius.zero,
- GallerySource? transitionSourceFor(
- Object id
- ComposeSubmitCallback? onSubmit,
- ComposePurpose purpose = ComposePurpose.mediaMessage,
- 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();
}
}