mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-09-07 19:14:12 +08:00
refactor: use withAreaBoxShape to apply the default AreaBox shape
This commit is contained in:
@@ -170,6 +170,16 @@ internal val LocalAreaBoxShape = compositionLocalOf { DefaultAreaBoxShape }
|
||||
|
||||
internal val DefaultAreaBoxShape: Shape = DefaultShapes.primary
|
||||
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
internal fun withAreaBoxShape(
|
||||
inBox: Shape = LocalAreaBoxShape.current,
|
||||
outBox: Shape = LocalShapes.current.secondary
|
||||
) = when (LocalInAreaBox.current) {
|
||||
true -> inBox
|
||||
else -> outBox
|
||||
}
|
||||
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
private fun defaultAreaBoxStyle() = AreaBoxStyle(
|
||||
|
@@ -249,10 +249,7 @@ private fun defaultButtonStyle() = ButtonStyle(
|
||||
horizontal = LocalSizes.current.spacingPrimary,
|
||||
vertical = LocalSizes.current.spacingSecondary
|
||||
),
|
||||
shape = when (LocalInAreaBox.current) {
|
||||
true -> LocalAreaBoxShape.current
|
||||
else -> LocalShapes.current.secondary
|
||||
},
|
||||
shape = withAreaBoxShape(),
|
||||
border = defaultButtonBorder()
|
||||
)
|
||||
|
||||
|
@@ -567,10 +567,7 @@ private fun defaultDropdownMenuColors() = DropdownMenuColors(
|
||||
@ReadOnlyComposable
|
||||
private fun defaultDropdownListStyle() = DropdownListStyle(
|
||||
padding = PaddingValues(LocalSizes.current.spacingSecondary),
|
||||
shape = when (LocalInAreaBox.current) {
|
||||
true -> LocalAreaBoxShape.current
|
||||
else -> LocalShapes.current.secondary
|
||||
},
|
||||
shape = withAreaBoxShape(),
|
||||
endIconSize = LocalSizes.current.iconSizeTertiary,
|
||||
borderInactive = defaultDropdownListInactiveBorder(),
|
||||
borderActive = defaultDropdownListActiveBorder()
|
||||
|
@@ -442,10 +442,7 @@ private fun defaultTabStyle() = TabStyle(
|
||||
horizontal = LocalSizes.current.spacingPrimary,
|
||||
vertical = LocalSizes.current.spacingSecondary,
|
||||
),
|
||||
contentShape = when (LocalInAreaBox.current) {
|
||||
true -> LocalAreaBoxShape.current
|
||||
else -> LocalShapes.current.secondary
|
||||
},
|
||||
contentShape = withAreaBoxShape(),
|
||||
indicatorWidth = Dp.Unspecified,
|
||||
indicatorHeight = DefaultTabIndicatorHeight,
|
||||
indicatorShape = LocalShapes.current.tertiary
|
||||
|
@@ -87,7 +87,6 @@ import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.PopupProperties
|
||||
import com.highcapable.flexiui.LocalColors
|
||||
import com.highcapable.flexiui.LocalShapes
|
||||
import com.highcapable.flexiui.LocalSizes
|
||||
import com.highcapable.flexiui.extension.borderOrNot
|
||||
import com.highcapable.flexiui.extension.calculateEnd
|
||||
@@ -788,10 +787,7 @@ private fun defaultTextFieldColors() = TextFieldColors(
|
||||
@ReadOnlyComposable
|
||||
private fun defaultTextFieldStyle() = TextFieldStyle(
|
||||
padding = PaddingValues(LocalSizes.current.spacingSecondary),
|
||||
shape = when (LocalInAreaBox.current) {
|
||||
true -> LocalAreaBoxShape.current
|
||||
else -> LocalShapes.current.secondary
|
||||
},
|
||||
shape = withAreaBoxShape(),
|
||||
borderInactive = defaultTextFieldInactiveBorder(),
|
||||
borderActive = defaultTextFieldActiveBorder(),
|
||||
completionStyle = DropdownMenu.style
|
||||
|
Reference in New Issue
Block a user