/
StepProperties.kt
62 lines (57 loc) · 2.16 KB
/
StepProperties.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.emirhanemmez.multistepsprogressbar.model
import androidx.compose.animation.core.AnimationSpec
import androidx.compose.animation.core.spring
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.emirhanemmez.multistepsprogressbar.defaultActiveTextColor
import com.emirhanemmez.multistepsprogressbar.defaultInactiveTextColor
import com.emirhanemmez.multistepsprogressbar.defaultIndicatorHeight
import com.emirhanemmez.multistepsprogressbar.defaultProgressBackgroundColor
import com.emirhanemmez.multistepsprogressbar.defaultProgressColor
data class StepProperties(
val progressProperties: ProgressProperties = ProgressProperties.default(),
val indicatorHeight: Dp = defaultIndicatorHeight,
val textProperties: TextProperties,
val marginBetweenSteps: Dp = 16.dp,
val marginBetweenTextAndProgress: Dp = 16.dp,
val animationSpec: AnimationSpec<Float> = spring()
)
data class TextProperties(
val textStyle: TextStyle,
val activeTextColor: Color,
val inActiveTextColor: Color,
val textAlign: TextAlign
) {
companion object {
@Composable
fun default(): TextProperties =
TextProperties(
textStyle = MaterialTheme.typography.bodySmall,
activeTextColor = defaultActiveTextColor,
inActiveTextColor = defaultInactiveTextColor,
textAlign = TextAlign.Start
)
}
}
data class ProgressProperties(
val progressColor: Color,
val progressBackgroundColor: Color,
val progressCornerRadius: Dp,
) {
companion object {
const val PROGRESS_NONE = 0f
const val PROGRESS_HALF = 0.5f
const val PROGRESS_FULL = 1f
fun default(): ProgressProperties =
ProgressProperties(
progressColor = defaultProgressColor,
progressBackgroundColor = defaultProgressBackgroundColor,
progressCornerRadius = 16.dp,
)
}
}