AlterMediaView class
A versatile media presentation widget supporting static images, animated GIFs, and pluggable media slots (such as video players, Lottie, Rive, or custom widgets).
Designed specifically for Alter Design System Markers and Blocks (GraphicsBlock, MobileMockupBlock) to showcase rich multimedia content without control chrome and with full WASM/Web compatibility.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- AlterMediaView
Constructors
-
AlterMediaView({Key? key, ImageProvider<
Object> ? image, String? url, String? assetPath, Widget? customWidget, Widget mediaBuilder(BuildContext context)?, AlterMediaType? mediaType, BoxFit fit = BoxFit.cover, BorderRadius? borderRadius, Border? border, double? aspectRatio, Widget? placeholder, bool loop = true, bool autoPlay = true, bool playInViewportOnly = true, Duration autoPlayDelay = const Duration(milliseconds: 1200), bool isMuted = true}) -
Creates an AlterMediaView instance.
const
Properties
- aspectRatio → double?
-
Aspect ratio constraint for the media (e.g. 16/9 for banners, 428/926 for mobile).
final
- assetPath → String?
-
Local asset path for image, GIF, or fallback media.
final
- autoPlay → bool
-
Legacy video parameter retained for API compatibility (no-op in v2.0.0+).
final
- autoPlayDelay → Duration
-
Legacy video parameter retained for API compatibility (no-op in v2.0.0+).
final
- border → Border?
-
Border applied to the media container.
final
- borderRadius → BorderRadius?
-
Corner radius applied to the media container.
final
- customWidget → Widget?
-
Custom widget override or slot (e.g. VideoPlayer, Lottie, Rive, custom canvas).
final
- fit → BoxFit
-
How the media should fit inside the container (defaults to BoxFit.cover).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
image
→ ImageProvider<
Object> ? -
Image provider for static images or GIFs.
final
- isMuted → bool
-
Legacy video parameter retained for API compatibility (no-op in v2.0.0+).
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loop → bool
-
Legacy video parameter retained for API compatibility (no-op in v2.0.0+).
final
- mediaBuilder → Widget Function(BuildContext context)?
-
Optional builder for responsive or slotted media.
final
- mediaType → AlterMediaType?
-
Explicitly specified media type (if null, automatically inferred).
final
- placeholder → Widget?
-
Placeholder widget displayed while media is loading or if no media is provided.
final
- playInViewportOnly → bool
-
Legacy video parameter retained for API compatibility (no-op in v2.0.0+).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- slot → Widget?
-
Backwards compatibility alias for customWidget.
no setter
- url → String?
-
Network URL for image, GIF, or fallback media.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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
Constants
- version → const String
- Component version for reference. v2.0.0: Transitioned to pluggable media slots and builders (100% WASM/Web compatible, zero dart:io dependencies). v1.1.0: Added viewport-aware autoplay control with configurable delay. v1.0.0: Initial release supporting Images, GIFs, and autoplay looping Videos.