-
public final class AsyncImagePainterKt
-
-
Method Summary
Modifier and Type Method Description final static AsyncImagePainterrememberAsyncImagePainter(Object model, ImageLoader imageLoader, Painter placeholder, Painter error, Painter fallback, Function1<AsyncImagePainter.State.Loading, Unit> onLoading, Function1<AsyncImagePainter.State.Success, Unit> onSuccess, Function1<AsyncImagePainter.State.Error, Unit> onError, ContentScale contentScale, FilterQuality filterQuality, EqualityDelegate modelEqualityDelegate)Return an AsyncImagePainter that executes an ImageRequest asynchronously and renders the result. final static AsyncImagePainterrememberAsyncImagePainter(Object model, ImageLoader imageLoader, Painter placeholder, Painter error, Painter fallback, Function1<AsyncImagePainter.State.Loading, Unit> onLoading, Function1<AsyncImagePainter.State.Success, Unit> onSuccess, Function1<AsyncImagePainter.State.Error, Unit> onError, ContentScale contentScale, FilterQuality filterQuality)final static AsyncImagePainterrememberAsyncImagePainter(Object model, ImageLoader imageLoader, Function1<AsyncImagePainter.State, AsyncImagePainter.State> transform, Function1<AsyncImagePainter.State, Unit> onState, ContentScale contentScale, FilterQuality filterQuality, EqualityDelegate modelEqualityDelegate)Return an AsyncImagePainter that executes an ImageRequest asynchronously and renders the result. final static AsyncImagePainterrememberAsyncImagePainter(Object model, ImageLoader imageLoader, Function1<AsyncImagePainter.State, AsyncImagePainter.State> transform, Function1<AsyncImagePainter.State, Unit> onState, ContentScale contentScale, FilterQuality filterQuality)-
-
Method Detail
-
rememberAsyncImagePainter
@Composable() final static AsyncImagePainter rememberAsyncImagePainter(Object model, ImageLoader imageLoader, Painter placeholder, Painter error, Painter fallback, Function1<AsyncImagePainter.State.Loading, Unit> onLoading, Function1<AsyncImagePainter.State.Success, Unit> onSuccess, Function1<AsyncImagePainter.State.Error, Unit> onError, ContentScale contentScale, FilterQuality filterQuality, EqualityDelegate modelEqualityDelegate)
Return an AsyncImagePainter that executes an ImageRequest asynchronously and renders the result.
** This is a lower-level API than AsyncImage and may not work as expected in all situations. **
AsyncImagePainter will not finish loading if AsyncImagePainter.onDraw is not called. This can occur if a composable has an unbounded (i.e. Constraints.Infinity) width/height constraint. For example, to use AsyncImagePainter with LazyRow or LazyColumn, you must set a bounded width or height respectively using
Modifier.widthorModifier.height.AsyncImagePainter.state will not transition to State.Success synchronously during the composition phase. Use SubcomposeAsyncImage or set a custom ImageRequest.Builder.size value (e.g.
size(Size.ORIGINAL)) if you need this.
- Parameters:
model- Either an ImageRequest or the ImageRequest.data value.imageLoader- The ImageLoader that will be used to execute the request.placeholder- A Painter that is displayed while the image is loading.error- A Painter that is displayed when the image request is unsuccessful.fallback- A Painter that is displayed when the request's ImageRequest.data is null.onLoading- Called when the image request begins loading.onSuccess- Called when the image request completes successfully.onError- Called when the image request completes unsuccessfully.contentScale- Used to determine the aspect ratio scaling to be used if the canvas bounds are a different size from the intrinsic size of the image loaded by model.filterQuality- Sampling algorithm applied to a bitmap when it is scaled and drawn into the destination.modelEqualityDelegate- Determines the equality of model.
-
rememberAsyncImagePainter
@Deprecated(message = Kept for binary compatibility., level = DeprecationLevel.HIDDEN)@Composable() final static AsyncImagePainter rememberAsyncImagePainter(Object model, ImageLoader imageLoader, Painter placeholder, Painter error, Painter fallback, Function1<AsyncImagePainter.State.Loading, Unit> onLoading, Function1<AsyncImagePainter.State.Success, Unit> onSuccess, Function1<AsyncImagePainter.State.Error, Unit> onError, ContentScale contentScale, FilterQuality filterQuality)
-
rememberAsyncImagePainter
@Composable() final static AsyncImagePainter rememberAsyncImagePainter(Object model, ImageLoader imageLoader, Function1<AsyncImagePainter.State, AsyncImagePainter.State> transform, Function1<AsyncImagePainter.State, Unit> onState, ContentScale contentScale, FilterQuality filterQuality, EqualityDelegate modelEqualityDelegate)
Return an AsyncImagePainter that executes an ImageRequest asynchronously and renders the result.
** This is a lower-level API than AsyncImage and may not work as expected in all situations. **
AsyncImagePainter will not finish loading if AsyncImagePainter.onDraw is not called. This can occur if a composable has an unbounded (i.e. Constraints.Infinity) width/height constraint. For example, to use AsyncImagePainter with LazyRow or LazyColumn, you must set a bounded width or height respectively using
Modifier.widthorModifier.height.AsyncImagePainter.state will not transition to State.Success synchronously during the composition phase. Use SubcomposeAsyncImage or set a custom ImageRequest.Builder.size value (e.g.
size(Size.ORIGINAL)) if you need this.
- Parameters:
model- Either an ImageRequest or the ImageRequest.data value.imageLoader- The ImageLoader that will be used to execute the request.transform- A callback to transform a new State before it's applied to the AsyncImagePainter.onState- Called when the state of this painter changes.contentScale- Used to determine the aspect ratio scaling to be used if the canvas bounds are a different size from the intrinsic size of the image loaded by model.filterQuality- Sampling algorithm applied to a bitmap when it is scaled and drawn into the destination.modelEqualityDelegate- Determines the equality of model.
-
rememberAsyncImagePainter
@Deprecated(message = Kept for binary compatibility., level = DeprecationLevel.HIDDEN)@Composable() final static AsyncImagePainter rememberAsyncImagePainter(Object model, ImageLoader imageLoader, Function1<AsyncImagePainter.State, AsyncImagePainter.State> transform, Function1<AsyncImagePainter.State, Unit> onState, ContentScale contentScale, FilterQuality filterQuality)
-
-
-
-