PreviewLabGallery

fun PreviewLabGallery(previewList: List<PreviewLabPreview>, modifier: Modifier = Modifier, state: PreviewLabGalleryState = remember { PreviewLabGalleryState() }, openFileHandler: OpenFileHandler<out Any?>? = null, featuredFileList: Map<String, List<String>> = emptyMap(), noSelectedContents: @Composable (Map<String, List<PreviewLabPreview>>) -> Unit = { groupedPreviews -> PreviewListGrid( groupedPreviewList = groupedPreviews, onPreviewClick = { group, preview -> state.select(group, preview) }, contentPadding = PaddingValues(adaptive(12.dp, 20.dp)), ) })

A Composable function that catalogs and displays a list of Previews. The left sidebar actually displays the list of Previews, and the selected Preview is displayed in the center of the screen.

Parameters

previewList

CollectedPreviews collected from gradle plugins, etc. Note that CollectedPreviews not specified here will not be displayed.

modifier

Modifier to be applied to the root layout of the PreviewLabGallery.

state

PreviewLabGalleryState to manage the state of the PreviewLabGallery. Preserves the state of the selected Preview, etc. By default, remember is used (i.e., the composition of the call to Composable is the scope of the state), but the scope (storage period) of the state can be adjusted by moving it to a state holder, such as ViewModel, if necessary.

openFileHandler

By specifying OpenFileHandler, you can display a "Source Code" button that displays the source code corresponding to the Preview.

featuredFileList

Map of group names to file paths for organizing previews into featured categories. Files matching these paths will be grouped under their respective category names in the preview list.

See also