Releases: Damercy/IncrementDecrementButton
Releases · Damercy/IncrementDecrementButton
v2.0.0
Added support for compose
IncrementDecrementButton is now available as a composable. The defaults of the composable are best described by the parameters of the composable in code itself.
@Composable
fun IncrementDecrementButton(
modifier: Modifier = Modifier,
fontFamily: FontFamily = FontFamily(typeface = Typeface.DEFAULT),
fontSize: TextUnit = 16.0.sp,
cornerRadius: Dp = 8.dp,
animationType: AnimationType = AnimationType.FADE,
backgroundColor: Color = MaterialTheme.colors.background,
contentColor: Color = MaterialTheme.colors.contentColorFor(backgroundColor),
borderStroke: BorderStroke = BorderStroke(0.dp, Color.White),
value: Int = 0,
onDecrementClick: (Int) -> Unit = {},
onIncrementClick: (Int) -> Unit = {},
onMiddleClick: (Int) -> Unit = {},
decrementComposable: @Composable (cb: (Int) -> Unit) -> Unit = { cb ->
DefaultDecrementComposable(
modifier = modifier,
textColor = contentColor,
fontFamily = fontFamily,
fontSize = fontSize,
backgroundColor = backgroundColor,
cornerRadius = cornerRadius,
borderStroke = borderStroke,
onDecrementClick = { cb(-1) }
)
},
incrementComposable: @Composable (cb: (Int) -> Unit) -> Unit = { cb ->
DefaultIncrementComposable(
modifier = modifier,
textColor = contentColor,
fontFamily = fontFamily,
fontSize = fontSize,
backgroundColor = backgroundColor,
cornerRadius = cornerRadius,
borderStroke = borderStroke,
onIncrementClick = { cb(-1) }
)
},
middleComposable: @Composable (Int, cb: (Int) -> Unit) -> Unit = { buttonValue, cb ->
DefaultMiddleComposable(
modifier = modifier,
textColor = contentColor,
fontFamily = fontFamily,
fontSize = fontSize,
backgroundColor = backgroundColor,
borderStroke = borderStroke,
onMiddleClick = { cb(-1) },
value = buttonValue
)
},
)
You can pass in your own composables as required.
v1.1.0
This release adds the following awesome features:
- Animations (
FADE
,VERTICAL
,HORIZONTAL
) - Ability to change
animation duration
- Ability to change
button text color
- Ability to change
button background color
- Ability to change
button corner radius
- Ability to set
button stroke color
- Ability to set
button stroke width
- Fix bug where previously
font size
was not getting updated
Feel free to open issues as and when you find them! 😄
Initial release v1.0.0
First release of IncrementDecrementButton
! 🎊
Features:
- Set
fontSize
,fontFamily
,increment/decrement/middle text
- Default cross fade animation on increment/decrement
- Get current value (amount)
- Add elevation and other
android:XXX
properties likeandroid:elevation
to add elevation effect etc