fix: disable preference footer buttons when there are no unsaved changes

Fixes #5282 by properly passing the enabled parameter to the ElevatedButtons in PreferenceFooter.
This commit is contained in:
James Rich
2026-04-29 09:02:31 -05:00
parent 5e415120d0
commit 77ecde6488
@@ -52,6 +52,7 @@ fun PreferenceFooter(
shapes = ButtonDefaults.shapesFor(mediumHeight),
modifier = Modifier.height(mediumHeight).weight(1f),
colors = ButtonDefaults.filledTonalButtonColors(),
enabled = enabled,
onClick = onNegativeClicked,
) {
Text(text = negativeText, style = ButtonDefaults.textStyleFor(mediumHeight))
@@ -63,7 +64,8 @@ fun PreferenceFooter(
shapes = ButtonDefaults.shapesFor(mediumHeight),
modifier = Modifier.height(mediumHeight).weight(1f),
colors = ButtonDefaults.buttonColors(),
onClick = { if (enabled) onPositiveClicked() },
enabled = enabled,
onClick = onPositiveClicked,
) {
Text(text = positiveText, style = ButtonDefaults.textStyleFor(mediumHeight))
}