Skip to content

Releases: Damercy/IncrementDecrementButton

v2.0.0

06 May 19:50
033bdd5
Compare
Choose a tag to compare

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

19 Feb 20:57
89d6061
Compare
Choose a tag to compare

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

09 Feb 17:29
Compare
Choose a tag to compare

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 like android:elevation to add elevation effect etc