caloriecounter
README.md
:OCCalorieCounter - A Custom Composable UI Component
This OCCalorieCounter is a custom Jetpack Compose component designed to trigger an action.
Features:
- Can display incremental/decremental values for Calorie Counter.
- Incremental default value can be configured.
- Decrement counter is disabled when count goes below 0.
- Animations are provided when counter is increased/decreased.
- Text can be customized.
- Icons can be customized
:How to use OCCalorieCounter
-
Add the necessary imports:
import your.package.name.OCCalorieCounter -
Use the
OCCalorieCounterwithin your Composable:OCCalorieCounter(
calorieIcon = {
Image(
painter = painterResource(R.drawable.ic_calorie),
contentDescription = null,
modifier = Modifier.padding(end = dimensions.eightDPSpacing, top = dimensions.twoDPSpacing)
)
},
incrementButton = {
Image(
painter = painterResource(R.drawable.ic_increment_counter),
contentDescription = null,
)
},
decrementButton = {
Icon(
painter = painterResource(R.drawable.ic_decrement_counter),
contentDescription = null,
tint = colors.buttonPrimaryOnBackgoundDisabled
)
},
)
Parameters:
modifier: Outlined card can be modified with modifierdefaultCounterValue: Represents the default value for the counterdefaultNetValue: Represents the default value for total caloriesstandardFactor: Represents the factor by which the calorie gets multipliedincrementButton: Composable image Increment ButtondecrementButton: Composable image Decrement ButtoncounterActivityUnit: Configuration to change text for Counter Label textcounterDetailsText: Configuration to change text for Counter details textcalorieMeasureUnit: Configuration to change unit for Calorie measurementcalorieIcon: Composable image for unit measurementreturnNetCalorie: Function callback to return net calorie