Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c6b3fa7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Screen Capture: Update RadioButtonGroup button colors" into main

parents f2c07b66 8da15e4d
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.size
import androidx.compose.material3.ButtonGroupDefaults
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.ToggleButton
import androidx.compose.material3.ToggleButtonColors
@@ -56,7 +57,7 @@ fun RadioButtonGroup(
    selectedIndex: Int,
    onSelect: (index: Int) -> Unit,
    modifier: Modifier = Modifier,
    colors: ToggleButtonColors = ToggleButtonDefaults.toggleButtonColors(),
    colors: ToggleButtonColors = defaultColors(),
) {
    require(selectedIndex in 0..items.size) { "selectedIndex is out of range of items." }

@@ -89,3 +90,13 @@ fun RadioButtonGroup(
        }
    }
}

@Composable
private fun defaultColors(): ToggleButtonColors {
    return ToggleButtonDefaults.toggleButtonColors(
        containerColor = MaterialTheme.colorScheme.secondaryContainer,
        contentColor = MaterialTheme.colorScheme.onSecondaryContainer,
        checkedContainerColor = MaterialTheme.colorScheme.secondary,
        checkedContentColor = MaterialTheme.colorScheme.onSecondary,
    )
}