Nutrient Settings View
The settings content the SDK's own settings sheet renders, as a composable you can place yourself.
The SDK offers three ways to put settings in front of a user, and this is the middle one.
Show the built-in sheet, by leaving
settingsMenuEnabledon and letting the toolbar's settings item open it. Nothing to write.Compose this, to keep the SDK's rows and theming but own where they appear, and to replace or decorate individual rows through settingsItem.
Render your own UI from the same data. Intercept the toolbar's settings item with
setOnToolbarItemClickListener, read the active configuration, and hand changes back through SettingsOptions. The catalog's Custom Settings, Info and Outline UI example does this.
Which rows appear is decided by SettingsOptions.visibleItems, the same way the built-in sheet decides it. This composable renders content only: it draws no sheet, scrim or dialog, so presentation is yours. Wrap it in whatever container you want, and give it a bounded height, because the rows scroll inside it.
NutrientSettingsView(
options = options,
onOptionsChanged = { options = it },
// Replace just the scroll direction row, and keep every other row as the SDK draws it.
settingsItem = { type, default ->
if (type == SettingsMenuItemType.SCROLL_DIRECTION) MyOwnScrollDirectionRow() else default()
},
)Parameters
The settings to render, and the source of which rows are visible.
Called with a new SettingsOptions whenever the user changes a setting. Applying it to the SDK is the caller's job, as is holding it as state so the rows recompose.
Applied to the content column.
Drawn above the rows. Defaults to the localized "Settings" title the built-in sheet uses; pass {} for no title.
Wraps each row. It receives the row's SettingsMenuItemType and the SDK's default rendering for it, so returning default() keeps the row, ignoring it replaces the row, and calling default() inside your own layout decorates it.