mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-09-07 19:14:12 +08:00
refactor: not use default prefix when there are no default value
This commit is contained in:
@@ -341,9 +341,9 @@ fun DropdownMenuItem(
|
||||
.then(modifier)
|
||||
.fillMaxWidth()
|
||||
.sizeIn(
|
||||
minWidth = DefaultMenuItemMinWidth,
|
||||
maxWidth = DefaultMenuItemMaxWidth,
|
||||
minHeight = DefaultMenuItemMinHeight
|
||||
minWidth = MenuItemMinWidth,
|
||||
maxWidth = MenuItemMaxWidth,
|
||||
minHeight = MenuItemMinHeight
|
||||
)
|
||||
.rippleClickable(
|
||||
enabled = enabled,
|
||||
@@ -604,6 +604,6 @@ private val DefaultMenuContentPadding = 16.dp
|
||||
private const val DefaultInTransitionDuration = 120
|
||||
private const val DefaultOutTransitionDuration = 90
|
||||
|
||||
private val DefaultMenuItemMinWidth = 112.dp
|
||||
private val DefaultMenuItemMaxWidth = 280.dp
|
||||
private val DefaultMenuItemMinHeight = 32.dp
|
||||
private val MenuItemMinWidth = 112.dp
|
||||
private val MenuItemMaxWidth = 280.dp
|
||||
private val MenuItemMinHeight = 32.dp
|
@@ -295,11 +295,11 @@ class TabRow internal constructor(
|
||||
val currentWidth = indicatorWidth.orElse() ?: currentTabPosition.tabWidth
|
||||
val animatedWidh by animateDpAsState(
|
||||
targetValue = currentWidth,
|
||||
animationSpec = tween(DefaultTabIndicatorDuration, easing = FastOutSlowInEasing)
|
||||
animationSpec = tween(TabIndicatorDuration, easing = FastOutSlowInEasing)
|
||||
)
|
||||
val animatedOffsetX by animateDpAsState(
|
||||
targetValue = currentTabPosition.calculateCenter(currentWidth),
|
||||
animationSpec = tween(DefaultTabIndicatorDuration, easing = FastOutSlowInEasing)
|
||||
animationSpec = tween(TabIndicatorDuration, easing = FastOutSlowInEasing)
|
||||
)
|
||||
fillMaxWidth()
|
||||
.wrapContentSize(Alignment.BottomStart)
|
||||
@@ -378,7 +378,7 @@ private class ScrollableTabData(private val scrollState: ScrollState, private va
|
||||
coroutineScope.launch {
|
||||
scrollState.animateScrollTo(
|
||||
value = calculatedOffset,
|
||||
animationSpec = tween(DefaultTabIndicatorDuration, easing = FastOutSlowInEasing)
|
||||
animationSpec = tween(TabIndicatorDuration, easing = FastOutSlowInEasing)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -448,5 +448,6 @@ private fun defaultTabStyle() = TabStyle(
|
||||
indicatorShape = LocalShapes.current.tertiary
|
||||
)
|
||||
|
||||
private const val DefaultTabIndicatorDuration = 250
|
||||
private val DefaultTabIndicatorHeight = 3.dp
|
||||
private val DefaultTabIndicatorHeight = 3.dp
|
||||
|
||||
private const val TabIndicatorDuration = 250
|
@@ -356,17 +356,17 @@ fun PasswordTextField(
|
||||
placeholder = placeholder,
|
||||
footer = {
|
||||
Box(
|
||||
modifier = Modifier.width(DefaultDecorIconSize),
|
||||
modifier = Modifier.width(TextDecorIconSize),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
val animatedSize by animateDpAsState(if (value.text.isNotEmpty()) DefaultDecorIconSize else 0.dp)
|
||||
val animatedSize by animateDpAsState(if (value.text.isNotEmpty()) TextDecorIconSize else 0.dp)
|
||||
val cInteractionSource = remember { MutableInteractionSource() }
|
||||
val pressed by cInteractionSource.collectIsPressedAsState()
|
||||
if (pressed) focusRequester.requestFocus()
|
||||
if (value.text.isEmpty() && animatedSize == 0.dp) passwordVisible = defaultPasswordVisible
|
||||
IconToggleButton(
|
||||
modifier = Modifier.size(animatedSize).pointerHoverState(TextFieldPointerState.Common),
|
||||
style = IconButton.style.copy(padding = DefaultDecorIconPadding),
|
||||
style = IconButton.style.copy(padding = TextDecorIconPadding),
|
||||
checked = passwordVisible,
|
||||
onCheckedChange = {
|
||||
passwordVisible = it
|
||||
@@ -471,10 +471,10 @@ fun BackspaceTextField(
|
||||
placeholder = placeholder,
|
||||
footer = {
|
||||
Box(
|
||||
modifier = Modifier.width(DefaultDecorIconSize),
|
||||
modifier = Modifier.width(TextDecorIconSize),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
val animatedSize by animateDpAsState(if (value.text.isNotEmpty()) DefaultDecorIconSize else 0.dp)
|
||||
val animatedSize by animateDpAsState(if (value.text.isNotEmpty()) TextDecorIconSize else 0.dp)
|
||||
val cInteractionSource = remember { MutableInteractionSource() }
|
||||
val pressed by cInteractionSource.collectIsPressedAsState()
|
||||
if (pressed) focusRequester.requestFocus()
|
||||
@@ -489,7 +489,7 @@ fun BackspaceTextField(
|
||||
focusRequester.requestFocus()
|
||||
},
|
||||
modifier = Modifier.width(animatedSize).pointerHoverState(TextFieldPointerState.Common),
|
||||
style = IconButton.style.copy(padding = DefaultDecorIconPadding),
|
||||
style = IconButton.style.copy(padding = TextDecorIconPadding),
|
||||
enabled = enabled,
|
||||
interactionSource = cInteractionSource
|
||||
) { Icon(imageVector = Icons.Backspace) }
|
||||
@@ -797,5 +797,5 @@ private fun defaultTextFieldInactiveBorder() = BorderStroke(LocalSizes.current.b
|
||||
@ReadOnlyComposable
|
||||
private fun defaultTextFieldActiveBorder() = BorderStroke(LocalSizes.current.borderSizePrimary, LocalColors.current.themePrimary)
|
||||
|
||||
private val DefaultDecorIconSize = 24.dp
|
||||
private val DefaultDecorIconPadding = PaddingValues(2.dp)
|
||||
private val TextDecorIconSize = 24.dp
|
||||
private val TextDecorIconPadding = PaddingValues(2.dp)
|
@@ -64,8 +64,8 @@ import androidx.compose.ui.window.rememberPopupPositionProviderAtPosition
|
||||
import com.highcapable.flexiui.LocalColors
|
||||
import com.highcapable.flexiui.LocalShapes
|
||||
import com.highcapable.flexiui.LocalSizes
|
||||
import com.highcapable.flexiui.interaction.rippleClickable
|
||||
import com.highcapable.flexiui.extension.orElse
|
||||
import com.highcapable.flexiui.interaction.rippleClickable
|
||||
import java.awt.event.KeyEvent
|
||||
|
||||
@Immutable
|
||||
@@ -150,9 +150,9 @@ private fun MenuItemContent(
|
||||
.onHover { hovered = it }
|
||||
.fillMaxWidth()
|
||||
.sizeIn(
|
||||
minWidth = DefaultMenuContentMinWidth,
|
||||
maxWidth = DefaultMenuContentMaxWidth,
|
||||
minHeight = DefaultMenuContentMinHeight
|
||||
minWidth = MenuContentMinWidth,
|
||||
maxWidth = MenuContentMaxWidth,
|
||||
minHeight = MenuContentMinHeight
|
||||
),
|
||||
color = Color.Transparent,
|
||||
style = style,
|
||||
@@ -218,7 +218,8 @@ internal fun defaultContextMenuStyle() = ContextMenuStyle(
|
||||
)
|
||||
)
|
||||
|
||||
private val DefaultMenuContentMinWidth = 112.dp
|
||||
private val DefaultMenuContentMaxWidth = 280.dp
|
||||
private val DefaultMenuContentMinHeight = 32.dp
|
||||
private val DefaultMenuContentPadding = 16.dp
|
||||
private val DefaultMenuContentPadding = 16.dp
|
||||
|
||||
private val MenuContentMinWidth = 112.dp
|
||||
private val MenuContentMaxWidth = 280.dp
|
||||
private val MenuContentMinHeight = 32.dp
|
Reference in New Issue
Block a user