allow renaming main layouts in subtypeScreen

This commit is contained in:
Helium314 2025-04-03 17:09:27 +02:00
parent d79c84d7df
commit 8edea4f7c5

View file

@ -412,10 +412,11 @@ private fun MainLayoutRow(
initialLayoutName = layoutName, initialLayoutName = layoutName,
startContent = startContent, startContent = startContent,
locale = currentSubtype.locale, locale = currentSubtype.locale,
// only can edit name for new custom layout isNameValid = { it !in customLayouts },
isNameValid = if (layoutName in customLayouts) null else ({ it !in customLayouts }),
onEdited = { onEdited = {
if (layoutName !in customLayouts) if (layoutName !in customLayouts // edited a built-in layout, set new one as current
|| layoutName != it && layoutName == currentSubtype.mainLayoutName() // layout name for current subtype changed
)
setCurrentSubtype(currentSubtype.withLayout(LayoutType.MAIN, it)) setCurrentSubtype(currentSubtype.withLayout(LayoutType.MAIN, it))
} }
) )