Skip to content

Commit

Permalink
O
Browse files Browse the repository at this point in the history
JL
>Merge branch 'main' of https://github.com/a914-gowtham/compose-ratingbar into main
  • Loading branch information
Gowtham committed Nov 11, 2021
2 parents 46f17c3 + d637f66 commit c66fe3b
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
A ratingbar for jetpack compose

[![](https://jitpack.io/v/a914-gowtham/compose-ratingbar.svg)](https://jitpack.io/#a914-gowtham/compose-ratingbar)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.a914-gowtham/compose-ratingbar.svg?label=Maven%20Central)](https://search.maven.org/artifact/io.github.a914-gowtham/compose-ratingbar/1.1.0/aar)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.a914-gowtham/compose-ratingbar.svg?label=mavenCentral)](https://search.maven.org/artifact/io.github.a914-gowtham/compose-ratingbar/1.1.0/aar)


<img src="https://github.com/a914-gowtham/compose-ratingbar/blob/main/demo_1.gif" width="340" height="260"/>
Expand All @@ -18,34 +18,40 @@ repositories {
// App build.gradle
dependencies {
implementation 'com.github.a914-gowtham:compose-ratingbar:1.1.0'
implementation 'com.github.a914-gowtham:compose-ratingbar:1.1.1'
//mavenCentral
// implementation 'io.github.a914-gowtham:compose-ratingbar:1.1.0'
// implementation 'io.github.a914-gowtham:compose-ratingbar:1.1.1'
}
```

## Usage
```kotlin
var value: Float by rememberSaveable { mutableStateOf(3.2f) } //initial rating value is 3.2 here
Column(){
RatingBar(value = value){
value=it
Log.d("TAG", "onRatingChanged: $it")
}
}
var rating: Float by remember { mutableStateOf(initialRating) }

RatingBar(value = rating,
ratingBarStyle = RatingBarStyle.HighLighted, onValueChange = {
rating = it
}) {
Log.d("TAG", "onRatingChanged: $it")
}
```

Ratingbar composable function has 11 params with default value as shown below
Ratingbar composable function has 13 params with default value as shown below
```kotlin
fun RatingBar(
modifier: Modifier = Modifier,
value: Float = 0f,
numStars: Int = 5, size: Dp = 26.dp, padding: Dp = 2.dp,
isIndicator: Boolean = false, activeColor: Color = Color(0xffffd740),
numStars: Int = 5,
size: Dp = 26.dp,
padding: Dp = 2.dp,
isIndicator: Boolean = false,
activeColor: Color = Color(0xffffd740),
inactiveColor: Color = Color(0xffffecb3),
stepSize: StepSize = StepSize.ONE,
ratingBarStyle: RatingBarStyle=RatingBarStyle.Normal,
stepSize: StepSize = StepSize.ONE,
hideInactiveStars: Boolean = false,
ratingBarStyle: RatingBarStyle = RatingBarStyle.Normal,
onValueChange: (Float) -> Unit,
onRatingChanged: (Float) -> Unit
)
```
Expand Down

0 comments on commit c66fe3b

Please sign in to comment.