ThemeSwitch

fun ThemeAnimationLayoutScope.ThemeSwitch(animationState: ThemeAnimationState, buttonIcon: ThemeSwitchIcon = DefaultButtonIcon, modifier: Modifier = Modifier, iconSize: DpSize = DpSize(20.dp, 20.dp), iconScale: Float = 1.0f, iconShape: Shape = RoundedCornerShape(50), iconTint: Color = MaterialTheme.colorScheme.primary, interactionSource: MutableInteractionSource? = null, indication: Indication? = LocalIndication.current)

A composable abstract switch that toggles themes in a binary or tristate transition.

Parameters

animationState

The ThemeAnimationState that controls the theme switch animation. This state tracks the current theme and manages the animation lifecycle.

buttonIcon

The icon to display on the switch. Defaults to DefaultButtonIcon which shows a sun icon for dark theme and moon icon for light theme. Custom icons can be provided using ThemeSwitchIcon implementations.

modifier

The modifier to be applied to the switch container. Note that due to the popup rendering, some layout modifiers may not behave as expected.

iconSize

The target size of the internal icon. Defaults to 20.dp.

iconScale

The scale factor to apply to the icon. Defaults to 1.0f (no scaling). Use values greater than 1.0f to enlarge the icon or less than 1.0f to shrink it.

iconShape

The shape to which the switch will be clipped.

iconTint

The tint that will be applied to the icon on the switch.