Skip to content

FullPageStatement

FullPageStatement is a full-page user agreement / privacy statement component in COUI, typically shown on first launch, mirroring ColorOS's COUIFullPageStatement (coui_full_page_statement.xml): a centered title, a scrollable statement body with vertical fading edges, and a bottom area holding a filled primary button plus an optional borderless exit text button.

The statement body takes all the space left between the title and the button area, so the buttons stay pinned to the bottom of the page.

Import

kotlin
import io.github.suqi8.coui.kmp.basic.FullPageStatement
import io.github.suqi8.coui.kmp.basic.FullPageStatementDefaults

Basic Usage

kotlin
FullPageStatement(
    title = "User Agreement & Privacy Policy",
    content = "Welcome! Before you continue, please read the statement carefully…",
    primaryButtonText = "Agree",
    onPrimaryButtonClick = { /* Continue */ },
    secondaryButtonText = "Disagree and exit",
    onSecondaryButtonClick = { /* Exit */ },
)

The component fills its parent (fillMaxSize), so it is normally hosted as a whole page, e.g. directly inside a Scaffold.

Properties

FullPageStatement Properties

PropertyTypeDescriptionDefault ValueRequired
titleStringCentered title (16sp, medium)-Yes
contentStringScrollable statement text (14sp, secondary color)-Yes
primaryButtonTextStringLabel of the filled primary button-Yes
onPrimaryButtonClick() -> UnitCallback of the primary button-Yes
modifierModifierModifier applied to the pageModifierNo
secondaryButtonTextString?Label of the exit text button; hidden when nullnullNo
onSecondaryButtonClick(() -> Unit)?Callback of the exit text buttonnullNo
primaryButtonWidthDp?Primary button width; null = COUI adaptive bucketsnullNo
colorsFullPageStatementColorsText color configurationFullPageStatementDefaults.fullPageStatementColors()No
primaryButtonColorsButtonColorsColors of the filled primary buttonButtonDefaults.buttonColorsPrimary()No
contentPaddingPaddingValuesPadding around the statement textFullPageStatementDefaults.ContentPaddingNo
scrollStateScrollStateScroll state of the statement arearememberScrollState()No

FullPageStatementDefaults Object

ConstantTypeDefault ValueCOUI source
TitleMarginTopDp12.dpcoui_full_page_statement_text_button_padding
TitleMarginBottomDp12.dpcoui_full_page_statement_content_margin
TitleMarginHorizontalDp24.dpcoui_full_page_statement_text_button_padding_horizontal
ContentPaddingPaddingValuesstart 24.dp, top 12.dp, end 24.dp, bottom 14.dpcoui_full_page_statement_padding_*
ScrollFadeLengthDp46.dpcoui_full_page_statement_scroll_fade_length
PrimaryButtonMarginTopDp20.dpcoui_full_page_statement_button_margin_top
PrimaryButtonMarginBottomDp16.dpcoui_full_page_statement_button_margin
SecondaryButtonMarginBottomDp24.dpcoui_full_page_statement_exit_button_margin_bottom
PrimaryButtonWidthCompactDp174.dpcoui_full_page_statement_button_width (base)
PrimaryButtonWidthMediumDp220.dpcoui_full_page_statement_button_width (values-w300dp)
PrimaryButtonWidthExpandedDp280.dpcoui_full_page_statement_button_width (values-w600dp)
MediumWidthThresholdDp300.dpvalues-w300dp bucket
ExpandedWidthThresholdDp600.dpvalues-w600dp bucket

FullPageStatementDefaults.primaryButtonWidth(availableWidth) resolves the COUI adaptive button width for a given available width.

fullPageStatementColors() factory

ParameterTypeDefaultCOUI role
titleColorColorCOUITheme.colorScheme.onBackgroundcouiColorPrimaryNeutral
contentColorColorCOUITheme.colorScheme.onSurfaceSecondarycouiColorSecondNeutral
secondaryButtonColorColorCOUITheme.colorScheme.primarycouiColorPrimaryTextOnPopup

FullPageStatementColors Class

Property NameTypeDescription
titleColorColorColor of the title
contentColorColorColor of the statement text
secondaryButtonColorColorColor of the exit text button

Behavior

  • The statement body scrolls and shows 46dp vertical fading edges that ramp in with the scroll offset, like the COUIMaxHeightScrollView host.
  • The primary button label is capped at two lines (COUIFullPageStatement setMaxLines(2)), with a fixed COUI bucket width: 174dp, 220dp from 300dp-wide windows and 280dp from 600dp-wide windows.
  • The exit button is a bare accent-colored text (16sp, medium) with no fill and no press overlay, matching the COUI txt_exit TextView.

Advanced Usage

Confirm-Only Statement

Omit secondaryButtonText (it defaults to null) to hide the exit text button:

kotlin
FullPageStatement(
    title = "User Agreement",
    content = "Welcome! Before you continue, please read the statement carefully…",
    primaryButtonText = "Got it",
    onPrimaryButtonClick = { /* Continue */ }
)

Fixed Primary Button Width

Pass primaryButtonWidth to override the COUI adaptive width buckets:

kotlin
FullPageStatement(
    title = "User Agreement",
    content = "Welcome! Before you continue, please read the statement carefully…",
    primaryButtonText = "Agree",
    onPrimaryButtonClick = { /* Continue */ },
    primaryButtonWidth = 240.dp
)

Custom Colors

kotlin
FullPageStatement(
    title = "User Agreement",
    content = "Welcome! Before you continue, please read the statement carefully…",
    primaryButtonText = "Agree",
    onPrimaryButtonClick = { /* Continue */ },
    secondaryButtonText = "Disagree and exit",
    onSecondaryButtonClick = { /* Exit */ },
    colors = FullPageStatementDefaults.fullPageStatementColors(
        contentColor = COUITheme.colorScheme.onBackground
    ),
    primaryButtonColors = ButtonDefaults.buttonColors()
)

Changelog

Released under the Apache-2.0 License