PRFMediaCarousel class

Full-screen media carousel with swipe navigation, zoom, and action buttons.

Replaces ImagePreviewPage with support for actions (delete, save) and video items via a builder callback.

Example:

await PRFMediaCarousel.show(
  context,
  items: [
    PRFCarouselItem(url: photo.url, isVideo: false),
    PRFCarouselItem(url: video.url, isVideo: true),
  ],
  initialIndex: 0,
  onSave: (item) => _download(item.url),
  onDelete: (index) async => await _confirmDelete(),
  videoBuilder: (context, item) => VideoPlayerPage(url: item.url),
);
Inheritance

Constructors

PRFMediaCarousel({required List<PRFCarouselItem> items, required int initialIndex, Future<bool> onDelete(int index)?, Future<void> onSave(PRFCarouselItem item)?, Widget videoBuilder(BuildContext context, PRFCarouselItem item)?, String closeTooltip = 'Close', String saveTooltip = 'Save to device', String deleteTooltip = 'Delete', String imageErrorText = 'Failed to load image', Key? key})
const

Properties

closeTooltip String
Tooltip for the close button.
final
deleteTooltip String
Tooltip for the delete button.
final
hashCode int
The hash code for this object.
no setterinherited
imageErrorText String
Text shown when an image fails to load.
final
initialIndex int
final
items List<PRFCarouselItem>
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDelete Future<bool> Function(int index)?
Called when the user taps the delete button. Receives the item index.
final
onSave Future<void> Function(PRFCarouselItem item)?
Called when the user taps the save/download button. Receives the item.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
saveTooltip String
Tooltip for the save button.
final
videoBuilder Widget Function(BuildContext context, PRFCarouselItem item)?
Builder for video pages. If null, videos show a placeholder.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<PRFMediaCarousel>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

show(BuildContext context, {required List<PRFCarouselItem> items, required int initialIndex, Future<bool> onDelete(int index)?, Future<void> onSave(PRFCarouselItem item)?, Widget videoBuilder(BuildContext context, PRFCarouselItem item)?, String closeTooltip = 'Close', String saveTooltip = 'Save to device', String deleteTooltip = 'Delete', String imageErrorText = 'Failed to load image'}) Future<void>
Opens the carousel as a full-screen route.