KiteDocLayout

@Immutable
sealed interface KiteDocLayout(source)

How KiteDocView lays its pages out and how the user moves between them.

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
@Immutable
data class Continuous(val orientation: Orientation = Orientation.Vertical, val contentPadding: PaddingValues = PaddingValues(0.dp), val fit: KitePageFit = KitePageFit.WIDTH, val prefetchPages: Int = 1) : KiteDocLayout

All pages in one continuous scrollable strip (lazy: offscreen pages are not composed). Pages fill the cross axis at their natural aspect ratio, or, with fit KitePageFit.PAGE, shrink until the whole page shows. Once the strip rests, prefetchPages pages on each side of the pages on screen draw into the bitmap cache.

Link copied to clipboard
@Immutable
data class Paged(val orientation: Orientation = Orientation.Horizontal, val offscreenPages: Int = 1, val reverseLayout: Boolean = false, val fit: KitePageFit = KitePageFit.PAGE) : KiteDocLayout

One page at a time with snap paging (swipe, or drive programmatically via KiteDocViewState). Each page is letterboxed to fit the viewport.

Link copied to clipboard
@Immutable
data class SinglePage(val pageIndex: Int) : KiteDocLayout

Exactly one fixed page, letterboxed to fit the viewport. pageIndex counts the pages of the whole document, as io.github.yuroyami.kitepdf.core.KiteDocument.pages does. A reflowable book that is still laying out shows a chapter placeholder until the chapters before the page are laid out, and then the page. An index outside the document shows its nearest page and logs a warning. Navigation does not turn a fixed page.

Link copied to clipboard
@Immutable
data class Spread(val orientation: Orientation = Orientation.Horizontal, val offscreenPages: Int = 1, val reverseLayout: Boolean = false, val firstPageAlone: Boolean = false) : KiteDocLayout

Two-page spreads: one snap-pager item shows two pages side by side, like an open book. Pages pair in order, (0, 1), (2, 3) and so on, except where the document declares otherwise (#37):