AdaptyCustomAsset

sealed interface AdaptyCustomAsset

Represents a customizable media or color asset used within Adapty Paywalls and Onboardings.

Use custom assets to override default images, videos, or colors displayed in your paywalls. This allows you to personalize the user experience — for example, showing a different image to specific user segments or providing a local placeholder while remote media loads.

Hero Assets

Hero elements have predefined IDs:

  • "hero_image"

  • "hero_video"

You can replace these assets directly using their IDs.

Custom IDs

For other images and videos, set a custom ID in the Adapty Dashboard to target them from your custom asset bundle.

Example use cases

  • Show different visuals for different audiences.

  • Display a local fallback image while a remote image is downloading.

  • Show a preview image before playing a video.

See also

for passing custom assets

Inheritors

Types

Link copied to clipboard
data class ColorAsset(val colorHex: String) : AdaptyCustomAsset

Defines a color asset using a HEX color string.

Link copied to clipboard
object Companion
Link copied to clipboard
data class LinearGradientAsset(val colors: List<String>, val stops: List<Float>? = null, val startX: Float = 0.0f, val startY: Float = 0.0f, val endX: Float = 1.0f, val endY: Float = 1.0f) : AdaptyCustomAsset

Defines a linear gradient composed of multiple colors.

Link copied to clipboard

Represents an image stored as raw byte data. Useful when loading images dynamically (e.g., from memory or a cache).

Link copied to clipboard
data class LocalImageFile(val path: String) : AdaptyCustomAsset

References an image file stored on the device file system. Use this if your image is located outside the app bundle.

Link copied to clipboard

References a local drawable or image resource from your app bundle.

Link copied to clipboard
data class LocalVideoFile(val path: String) : AdaptyCustomAsset

References a video stored on the device file system.

Link copied to clipboard
data class LocalVideoResource(val assetId: String) : AdaptyCustomAsset

References a local video resource bundled with the app. The file should be placed under: commonMain/composeResources/files/...