mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-09-08 19:44:25 +08:00
refactor: merge all padding to paddings data class
This commit is contained in:
@@ -51,20 +51,18 @@ import com.highcapable.flexiui.LocalColors
|
|||||||
import com.highcapable.flexiui.LocalShapes
|
import com.highcapable.flexiui.LocalShapes
|
||||||
import com.highcapable.flexiui.LocalSizes
|
import com.highcapable.flexiui.LocalSizes
|
||||||
import com.highcapable.flexiui.utils.borderOrNot
|
import com.highcapable.flexiui.utils.borderOrNot
|
||||||
import com.highcapable.flexiui.utils.orElse
|
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
data class AreaBoxStyle(
|
data class AreaBoxStyle(
|
||||||
val padding: Dp,
|
val paddings: AreaBoxPaddings,
|
||||||
val topPadding: Dp,
|
|
||||||
val startPadding: Dp,
|
|
||||||
val bottomPadding: Dp,
|
|
||||||
val endPadding: Dp,
|
|
||||||
val shape: Shape,
|
val shape: Shape,
|
||||||
val border: BorderStroke,
|
val border: BorderStroke,
|
||||||
val shadowSize: Dp
|
val shadowSize: Dp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Immutable
|
||||||
|
data class AreaBoxPaddings(val start: Dp, val top: Dp, val end: Dp, val bottom: Dp)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AreaBox(
|
fun AreaBox(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
@@ -146,10 +144,10 @@ private fun Modifier.box(
|
|||||||
.borderOrNot(style.border, style.shape)
|
.borderOrNot(style.border, style.shape)
|
||||||
.then(modifier)
|
.then(modifier)
|
||||||
.padding(
|
.padding(
|
||||||
top = style.topPadding.orElse() ?: style.padding,
|
start = style.paddings.start,
|
||||||
start = style.startPadding.orElse() ?: style.padding,
|
top = style.paddings.top,
|
||||||
bottom = style.bottomPadding.orElse() ?: style.padding,
|
end = style.paddings.end,
|
||||||
end = style.endPadding.orElse() ?: style.padding
|
bottom = style.paddings.bottom
|
||||||
)
|
)
|
||||||
|
|
||||||
object AreaBox {
|
object AreaBox {
|
||||||
@@ -172,11 +170,12 @@ internal val DefaultAreaBoxShape: Shape = DefaultShapes.primary
|
|||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultAreaBoxStyle() = AreaBoxStyle(
|
private fun defaultAreaBoxStyle() = AreaBoxStyle(
|
||||||
padding = LocalSizes.current.spacingPrimary,
|
paddings = AreaBoxPaddings(
|
||||||
topPadding = Dp.Unspecified,
|
start = defaultAreaBoxPadding(),
|
||||||
startPadding = Dp.Unspecified,
|
top = defaultAreaBoxPadding(),
|
||||||
bottomPadding = Dp.Unspecified,
|
end = defaultAreaBoxPadding(),
|
||||||
endPadding = Dp.Unspecified,
|
bottom = defaultAreaBoxPadding()
|
||||||
|
),
|
||||||
shape = LocalShapes.current.primary,
|
shape = LocalShapes.current.primary,
|
||||||
border = defaultAreaBoxBorder(),
|
border = defaultAreaBoxBorder(),
|
||||||
shadowSize = DefaultAreaBoxShadowSize
|
shadowSize = DefaultAreaBoxShadowSize
|
||||||
@@ -190,4 +189,8 @@ private fun defaultAreaBoxColor() = LocalColors.current.foregroundPrimary
|
|||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultAreaBoxBorder() = BorderStroke(LocalSizes.current.borderSizeTertiary, LocalColors.current.textPrimary)
|
private fun defaultAreaBoxBorder() = BorderStroke(LocalSizes.current.borderSizeTertiary, LocalColors.current.textPrimary)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@ReadOnlyComposable
|
||||||
|
private fun defaultAreaBoxPadding() = LocalSizes.current.spacingPrimary
|
||||||
|
|
||||||
private val DefaultAreaBoxShadowSize = 0.dp
|
private val DefaultAreaBoxShadowSize = 0.dp
|
@@ -62,15 +62,14 @@ data class ButtonColors(
|
|||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
data class ButtonStyle(
|
data class ButtonStyle(
|
||||||
val padding: Dp,
|
val paddings: ButtonPaddings,
|
||||||
val topPadding: Dp,
|
|
||||||
val startPadding: Dp,
|
|
||||||
val bottomPadding: Dp,
|
|
||||||
val endPadding: Dp,
|
|
||||||
val shape: Shape,
|
val shape: Shape,
|
||||||
val border: BorderStroke
|
val border: BorderStroke
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Immutable
|
||||||
|
data class ButtonPaddings(val start: Dp, val top: Dp, val end: Dp, val bottom: Dp)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Button(
|
fun Button(
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
@@ -189,10 +188,10 @@ private fun Modifier.button(
|
|||||||
.then(modifier)
|
.then(modifier)
|
||||||
|
|
||||||
private fun Modifier.buttonPadding(style: ButtonStyle) = padding(
|
private fun Modifier.buttonPadding(style: ButtonStyle) = padding(
|
||||||
top = style.topPadding.orElse() ?: style.padding,
|
start = style.paddings.start,
|
||||||
start = style.startPadding.orElse() ?: style.padding,
|
top = style.paddings.top,
|
||||||
bottom = style.bottomPadding.orElse() ?: style.padding,
|
end = style.paddings.end,
|
||||||
end = style.endPadding.orElse() ?: style.padding
|
bottom = style.paddings.bottom
|
||||||
)
|
)
|
||||||
|
|
||||||
object Button {
|
object Button {
|
||||||
@@ -247,11 +246,12 @@ private fun defaultIconButtonColors() = ButtonColors(
|
|||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultButtonStyle() = ButtonStyle(
|
private fun defaultButtonStyle() = ButtonStyle(
|
||||||
padding = Dp.Unspecified,
|
paddings = ButtonPaddings(
|
||||||
topPadding = LocalSizes.current.spacingSecondary,
|
start = LocalSizes.current.spacingPrimary,
|
||||||
startPadding = LocalSizes.current.spacingPrimary,
|
top = LocalSizes.current.spacingSecondary,
|
||||||
bottomPadding = LocalSizes.current.spacingSecondary,
|
end = LocalSizes.current.spacingPrimary,
|
||||||
endPadding = LocalSizes.current.spacingPrimary,
|
bottom = LocalSizes.current.spacingSecondary
|
||||||
|
),
|
||||||
shape = when (LocalInAreaBox.current) {
|
shape = when (LocalInAreaBox.current) {
|
||||||
true -> LocalAreaBoxShape.current
|
true -> LocalAreaBoxShape.current
|
||||||
else -> LocalShapes.current.tertiary
|
else -> LocalShapes.current.tertiary
|
||||||
@@ -262,11 +262,7 @@ private fun defaultButtonStyle() = ButtonStyle(
|
|||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultIconButtonStyle() = ButtonStyle(
|
private fun defaultIconButtonStyle() = ButtonStyle(
|
||||||
padding = 0.dp,
|
paddings = ButtonPaddings(0.dp, 0.dp, 0.dp, 0.dp),
|
||||||
topPadding = Dp.Unspecified,
|
|
||||||
startPadding = Dp.Unspecified,
|
|
||||||
bottomPadding = Dp.Unspecified,
|
|
||||||
endPadding = Dp.Unspecified,
|
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
border = defaultButtonBorder()
|
border = defaultButtonBorder()
|
||||||
)
|
)
|
||||||
|
@@ -131,11 +131,7 @@ data class DropdownMenuColors(
|
|||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
data class DropdownListStyle(
|
data class DropdownListStyle(
|
||||||
val padding: Dp,
|
val paddings: DropdownListPaddings,
|
||||||
val topPadding: Dp,
|
|
||||||
val startPadding: Dp,
|
|
||||||
val bottomPadding: Dp,
|
|
||||||
val endPadding: Dp,
|
|
||||||
val shape: Shape,
|
val shape: Shape,
|
||||||
val endIconSize: Dp,
|
val endIconSize: Dp,
|
||||||
val borderInactive: BorderStroke,
|
val borderInactive: BorderStroke,
|
||||||
@@ -150,6 +146,9 @@ data class DropdownMenuStyle(
|
|||||||
val borderStyle: AreaBoxStyle
|
val borderStyle: AreaBoxStyle
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Immutable
|
||||||
|
data class DropdownListPaddings(val start: Dp, val top: Dp, val end: Dp, val bottom: Dp)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DropdownList(
|
fun DropdownList(
|
||||||
expanded: Boolean,
|
expanded: Boolean,
|
||||||
@@ -169,8 +168,6 @@ fun DropdownList(
|
|||||||
val focused by interactionSource.collectIsFocusedAsState()
|
val focused by interactionSource.collectIsFocusedAsState()
|
||||||
val hovered by interactionSource.collectIsHoveredAsState()
|
val hovered by interactionSource.collectIsHoveredAsState()
|
||||||
val focusRequester = remember { FocusRequester() }
|
val focusRequester = remember { FocusRequester() }
|
||||||
val startPadding = style.startPadding.orElse() ?: style.padding
|
|
||||||
val endPadding = style.endPadding.orElse() ?: style.padding
|
|
||||||
val animatedEndIconTint by animateColorAsState(when {
|
val animatedEndIconTint by animateColorAsState(when {
|
||||||
focused || hovered -> colors.endIconActiveTint
|
focused || hovered -> colors.endIconActiveTint
|
||||||
else -> colors.endIconInactiveTint
|
else -> colors.endIconInactiveTint
|
||||||
@@ -206,7 +203,7 @@ fun DropdownList(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
val menuMaxWidth = maxWidth + startPadding + endPadding
|
val menuMaxWidth = maxWidth + style.paddings.start + style.paddings.end
|
||||||
// Note: If minWidth is not 0, a constant width is currently set.
|
// Note: If minWidth is not 0, a constant width is currently set.
|
||||||
// At this time, the child layout must be completely filled into the parent layout.
|
// At this time, the child layout must be completely filled into the parent layout.
|
||||||
val needInflatable = minWidth > 0.dp
|
val needInflatable = minWidth > 0.dp
|
||||||
@@ -429,10 +426,10 @@ private fun Modifier.dropdownList(
|
|||||||
.borderOrNot(border, style.shape)
|
.borderOrNot(border, style.shape)
|
||||||
.then(modifier)
|
.then(modifier)
|
||||||
.padding(
|
.padding(
|
||||||
top = style.topPadding.orElse() ?: style.padding,
|
start = style.paddings.start,
|
||||||
start = style.startPadding.orElse() ?: style.padding,
|
top = style.paddings.top,
|
||||||
bottom = style.bottomPadding.orElse() ?: style.padding,
|
end = style.paddings.end,
|
||||||
end = style.endPadding.orElse() ?: style.padding
|
bottom = style.paddings.bottom
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun calculateTransformOrigin(parentBounds: IntRect, menuBounds: IntRect): TransformOrigin {
|
private fun calculateTransformOrigin(parentBounds: IntRect, menuBounds: IntRect): TransformOrigin {
|
||||||
@@ -563,11 +560,12 @@ private fun defaultDropdownMenuColors() = DropdownMenuColors(
|
|||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultDropdownListStyle() = DropdownListStyle(
|
private fun defaultDropdownListStyle() = DropdownListStyle(
|
||||||
padding = LocalSizes.current.spacingSecondary,
|
paddings = DropdownListPaddings(
|
||||||
topPadding = Dp.Unspecified,
|
start = defaultDropdownListPadding(),
|
||||||
startPadding = Dp.Unspecified,
|
top = defaultDropdownListPadding(),
|
||||||
bottomPadding = Dp.Unspecified,
|
end = defaultDropdownListPadding(),
|
||||||
endPadding = Dp.Unspecified,
|
bottom = defaultDropdownListPadding()
|
||||||
|
),
|
||||||
shape = when (LocalInAreaBox.current) {
|
shape = when (LocalInAreaBox.current) {
|
||||||
true -> LocalAreaBoxShape.current
|
true -> LocalAreaBoxShape.current
|
||||||
else -> LocalShapes.current.secondary
|
else -> LocalShapes.current.secondary
|
||||||
@@ -583,13 +581,21 @@ private fun defaultDropdownMenuStyle() = DropdownMenuStyle(
|
|||||||
inTransitionDuration = DefaultInTransitionDuration,
|
inTransitionDuration = DefaultInTransitionDuration,
|
||||||
outTransitionDuration = DefaultOutTransitionDuration,
|
outTransitionDuration = DefaultOutTransitionDuration,
|
||||||
contentStyle = AreaBox.style.copy(
|
contentStyle = AreaBox.style.copy(
|
||||||
padding = 0.dp,
|
paddings = AreaBoxPaddings(
|
||||||
startPadding = DefaultMenuContentPadding,
|
start = DefaultMenuContentPadding,
|
||||||
endPadding = DefaultMenuContentPadding,
|
top = 0.dp,
|
||||||
|
end = DefaultMenuContentPadding,
|
||||||
|
bottom = 0.dp
|
||||||
|
),
|
||||||
shape = LocalShapes.current.secondary
|
shape = LocalShapes.current.secondary
|
||||||
),
|
),
|
||||||
borderStyle = AreaBox.style.copy(
|
borderStyle = AreaBox.style.copy(
|
||||||
padding = LocalSizes.current.spacingTertiary,
|
paddings = AreaBoxPaddings(
|
||||||
|
start = defaultDropdownListBorderPadding(),
|
||||||
|
top = defaultDropdownListBorderPadding(),
|
||||||
|
end = defaultDropdownListBorderPadding(),
|
||||||
|
bottom = defaultDropdownListBorderPadding()
|
||||||
|
),
|
||||||
shadowSize = LocalSizes.current.zoomSizeTertiary,
|
shadowSize = LocalSizes.current.zoomSizeTertiary,
|
||||||
shape = LocalShapes.current.primary
|
shape = LocalShapes.current.primary
|
||||||
)
|
)
|
||||||
@@ -603,6 +609,14 @@ private fun defaultDropdownListInactiveBorder() = BorderStroke(LocalSizes.curren
|
|||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultDropdownListActiveBorder() = BorderStroke(LocalSizes.current.borderSizePrimary, LocalColors.current.themePrimary)
|
private fun defaultDropdownListActiveBorder() = BorderStroke(LocalSizes.current.borderSizePrimary, LocalColors.current.themePrimary)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@ReadOnlyComposable
|
||||||
|
private fun defaultDropdownListPadding() = LocalSizes.current.spacingSecondary
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@ReadOnlyComposable
|
||||||
|
private fun defaultDropdownListBorderPadding() = LocalSizes.current.spacingTertiary
|
||||||
|
|
||||||
private val DefaultDropdownListMenuOffset = DpOffset((-10).dp, 10.dp)
|
private val DefaultDropdownListMenuOffset = DpOffset((-10).dp, 10.dp)
|
||||||
|
|
||||||
private val DefaultMenuContentPadding = 16.dp
|
private val DefaultMenuContentPadding = 16.dp
|
||||||
|
@@ -36,7 +36,6 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import com.highcapable.flexiui.LocalColors
|
import com.highcapable.flexiui.LocalColors
|
||||||
import com.highcapable.flexiui.LocalSizes
|
import com.highcapable.flexiui.LocalSizes
|
||||||
import com.highcapable.flexiui.utils.orElse
|
|
||||||
|
|
||||||
// TODO: Linkage BetterAndroid SafeArea (SystemBarsController)
|
// TODO: Linkage BetterAndroid SafeArea (SystemBarsController)
|
||||||
|
|
||||||
@@ -48,13 +47,12 @@ data class SurfaceColors(
|
|||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
data class SurfaceStyle(
|
data class SurfaceStyle(
|
||||||
val padding: Dp,
|
val paddings: SurfacePaddings
|
||||||
val topPadding: Dp,
|
|
||||||
val startPadding: Dp,
|
|
||||||
val bottomPadding: Dp,
|
|
||||||
val endPadding: Dp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Immutable
|
||||||
|
data class SurfacePaddings(val start: Dp, val top: Dp, val end: Dp, val bottom: Dp)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Surface(
|
fun Surface(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
@@ -80,10 +78,10 @@ private fun Modifier.surface(
|
|||||||
.background(colors.backgroundColor)
|
.background(colors.backgroundColor)
|
||||||
.then(modifier)
|
.then(modifier)
|
||||||
.padding(
|
.padding(
|
||||||
top = style.topPadding.orElse() ?: style.padding,
|
start = style.paddings.start,
|
||||||
start = style.startPadding.orElse() ?: style.padding,
|
top = style.paddings.top,
|
||||||
bottom = style.bottomPadding.orElse() ?: style.padding,
|
end = style.paddings.end,
|
||||||
end = style.endPadding.orElse() ?: style.padding
|
bottom = style.paddings.bottom
|
||||||
)
|
)
|
||||||
|
|
||||||
object Surface {
|
object Surface {
|
||||||
@@ -107,9 +105,14 @@ private fun defaultSurfaceColors() = SurfaceColors(
|
|||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultSurfaceStyle() = SurfaceStyle(
|
private fun defaultSurfaceStyle() = SurfaceStyle(
|
||||||
padding = LocalSizes.current.spacingPrimary,
|
paddings = SurfacePaddings(
|
||||||
topPadding = Dp.Unspecified,
|
start = defaultSurfacePaddings(),
|
||||||
startPadding = Dp.Unspecified,
|
top = defaultSurfacePaddings(),
|
||||||
bottomPadding = Dp.Unspecified,
|
end = defaultSurfacePaddings(),
|
||||||
endPadding = Dp.Unspecified
|
bottom = defaultSurfacePaddings()
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@ReadOnlyComposable
|
||||||
|
private fun defaultSurfacePaddings() = LocalSizes.current.spacingPrimary
|
@@ -115,11 +115,7 @@ data class AutoCompleteBoxColors(
|
|||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
data class TextFieldStyle(
|
data class TextFieldStyle(
|
||||||
val padding: Dp,
|
val paddings: TextFieldPaddings,
|
||||||
val topPadding: Dp,
|
|
||||||
val startPadding: Dp,
|
|
||||||
val bottomPadding: Dp,
|
|
||||||
val endPadding: Dp,
|
|
||||||
val shape: Shape,
|
val shape: Shape,
|
||||||
val borderInactive: BorderStroke,
|
val borderInactive: BorderStroke,
|
||||||
val borderActive: BorderStroke,
|
val borderActive: BorderStroke,
|
||||||
@@ -134,6 +130,9 @@ data class AutoCompleteOptions(
|
|||||||
val threshold: Int = 2
|
val threshold: Int = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Immutable
|
||||||
|
data class TextFieldPaddings(val start: Dp, val top: Dp, val end: Dp, val bottom: Dp)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TextField(
|
fun TextField(
|
||||||
value: TextFieldValue,
|
value: TextFieldValue,
|
||||||
@@ -365,7 +364,7 @@ fun PasswordTextField(
|
|||||||
if (value.text.isEmpty() && animatedSize == 0.dp) passwordVisible = defaultPasswordVisible
|
if (value.text.isEmpty() && animatedSize == 0.dp) passwordVisible = defaultPasswordVisible
|
||||||
IconToggleButton(
|
IconToggleButton(
|
||||||
modifier = Modifier.size(animatedSize).pointerHoverState(TextFieldPointerState.NORMAL),
|
modifier = Modifier.size(animatedSize).pointerHoverState(TextFieldPointerState.NORMAL),
|
||||||
style = IconButton.style.copy(padding = DefaultDecorIconPadding),
|
style = IconButton.style.copy(paddings = DefaultDecorIconPaddings),
|
||||||
checked = passwordVisible,
|
checked = passwordVisible,
|
||||||
onCheckedChange = {
|
onCheckedChange = {
|
||||||
passwordVisible = it
|
passwordVisible = it
|
||||||
@@ -492,7 +491,7 @@ fun BackspaceTextField(
|
|||||||
focusRequester.requestFocus()
|
focusRequester.requestFocus()
|
||||||
},
|
},
|
||||||
modifier = Modifier.width(animatedSize).pointerHoverState(TextFieldPointerState.NORMAL),
|
modifier = Modifier.width(animatedSize).pointerHoverState(TextFieldPointerState.NORMAL),
|
||||||
style = IconButton.style.copy(padding = DefaultDecorIconPadding),
|
style = IconButton.style.copy(paddings = DefaultDecorIconPaddings),
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
interactionSource = cInteractionSource
|
interactionSource = cInteractionSource
|
||||||
) { Icon(imageVector = Icons.Backspace) }
|
) { Icon(imageVector = Icons.Backspace) }
|
||||||
@@ -732,13 +731,13 @@ private fun Modifier.textFieldPadding(
|
|||||||
fitEnd: Boolean = false
|
fitEnd: Boolean = false
|
||||||
) = when {
|
) = when {
|
||||||
!fitStart && !fitEnd -> padding(
|
!fitStart && !fitEnd -> padding(
|
||||||
top = style.topPadding.orElse() ?: style.padding,
|
start = style.paddings.start,
|
||||||
start = style.startPadding.orElse() ?: style.padding,
|
top = style.paddings.top,
|
||||||
bottom = style.bottomPadding.orElse() ?: style.padding,
|
end = style.paddings.end,
|
||||||
end = style.endPadding.orElse() ?: style.padding
|
bottom = style.paddings.bottom
|
||||||
)
|
)
|
||||||
fitStart -> padding(start = style.startPadding.orElse() ?: style.padding)
|
fitStart -> padding(start = style.paddings.start)
|
||||||
fitEnd -> padding(end = style.endPadding.orElse() ?: style.padding)
|
fitEnd -> padding(end = style.paddings.end)
|
||||||
else -> this
|
else -> this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -779,11 +778,12 @@ private fun defaultTextFieldColors() = TextFieldColors(
|
|||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultTextFieldStyle() = TextFieldStyle(
|
private fun defaultTextFieldStyle() = TextFieldStyle(
|
||||||
padding = LocalSizes.current.spacingSecondary,
|
paddings = TextFieldPaddings(
|
||||||
topPadding = Dp.Unspecified,
|
start = defaultTextFieldPadding(),
|
||||||
startPadding = Dp.Unspecified,
|
top = defaultTextFieldPadding(),
|
||||||
bottomPadding = Dp.Unspecified,
|
end = defaultTextFieldPadding(),
|
||||||
endPadding = Dp.Unspecified,
|
bottom = defaultTextFieldPadding()
|
||||||
|
),
|
||||||
shape = when (LocalInAreaBox.current) {
|
shape = when (LocalInAreaBox.current) {
|
||||||
true -> LocalAreaBoxShape.current
|
true -> LocalAreaBoxShape.current
|
||||||
else -> LocalShapes.current.secondary
|
else -> LocalShapes.current.secondary
|
||||||
@@ -801,5 +801,9 @@ private fun defaultTextFieldInactiveBorder() = BorderStroke(LocalSizes.current.b
|
|||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultTextFieldActiveBorder() = BorderStroke(LocalSizes.current.borderSizePrimary, LocalColors.current.themePrimary)
|
private fun defaultTextFieldActiveBorder() = BorderStroke(LocalSizes.current.borderSizePrimary, LocalColors.current.themePrimary)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@ReadOnlyComposable
|
||||||
|
private fun defaultTextFieldPadding() = LocalSizes.current.spacingSecondary
|
||||||
|
|
||||||
private val DefaultDecorIconSize = 24.dp
|
private val DefaultDecorIconSize = 24.dp
|
||||||
private val DefaultDecorIconPadding = 2.dp
|
private val DefaultDecorIconPaddings = ButtonPaddings(2.dp, 2.dp, 2.dp, 2.dp)
|
@@ -207,18 +207,30 @@ internal fun defaultContextMenuColors() = ContextMenuColors(
|
|||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
internal fun defaultContextMenuStyle() = ContextMenuStyle(
|
internal fun defaultContextMenuStyle() = ContextMenuStyle(
|
||||||
contentStyle = LocalContextMenuStyle.current.contentStyle ?: AreaBox.style.copy(
|
contentStyle = LocalContextMenuStyle.current.contentStyle ?: AreaBox.style.copy(
|
||||||
padding = 0.dp,
|
paddings = AreaBoxPaddings(
|
||||||
startPadding = DefaultMenuContentPadding,
|
start = DefaultMenuContentPadding,
|
||||||
endPadding = DefaultMenuContentPadding,
|
top = 0.dp,
|
||||||
|
end = DefaultMenuContentPadding,
|
||||||
|
bottom = 0.dp
|
||||||
|
),
|
||||||
shape = LocalShapes.current.secondary
|
shape = LocalShapes.current.secondary
|
||||||
),
|
),
|
||||||
borderStyle = LocalContextMenuStyle.current.borderStyle ?: AreaBox.style.copy(
|
borderStyle = LocalContextMenuStyle.current.borderStyle ?: AreaBox.style.copy(
|
||||||
padding = LocalSizes.current.spacingTertiary,
|
paddings = AreaBoxPaddings(
|
||||||
|
start = defaultContextMenuBorderPadding(),
|
||||||
|
top = defaultContextMenuBorderPadding(),
|
||||||
|
end = defaultContextMenuBorderPadding(),
|
||||||
|
bottom = defaultContextMenuBorderPadding()
|
||||||
|
),
|
||||||
shadowSize = LocalSizes.current.zoomSizeTertiary,
|
shadowSize = LocalSizes.current.zoomSizeTertiary,
|
||||||
shape = LocalShapes.current.primary
|
shape = LocalShapes.current.primary
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@ReadOnlyComposable
|
||||||
|
private fun defaultContextMenuBorderPadding() = LocalSizes.current.spacingTertiary
|
||||||
|
|
||||||
private val DefaultMenuContentMinWidth = 112.dp
|
private val DefaultMenuContentMinWidth = 112.dp
|
||||||
private val DefaultMenuContentMaxWidth = 280.dp
|
private val DefaultMenuContentMaxWidth = 280.dp
|
||||||
private val DefaultMenuContentMinHeight = 32.dp
|
private val DefaultMenuContentMinHeight = 32.dp
|
||||||
|
Reference in New Issue
Block a user