|
91 | 91 | | `fontSize` | The size of glyphs to use when painting the text. | `TextUnit.Unspecified` | |
92 | 92 | | `fontStyle` | The typeface variant to use when drawing the letters (e.g., italic). | `null` | |
93 | 93 | | `fontFamily` | The font family to be used when rendering the text. | `null` | |
| 94 | +| `fontWeight` | The typeface thickness to use when painting the text (e.g., [FontWeight.Bold]). | `null` | |
94 | 95 | | `hourHandColor` | Color will be apply to hour hand in clock type animation only. | `Color.Black` | |
| 96 | +| `customLoadingIconPainter` | painter [Painter] to draw your custom loading icon. | `painterResource(id = R.drawable.simform_logo)` | |
| 97 | +| `customLoadingEffect` | Custom loading animation type like roation, zoom in out etc. | `SSCustomLoadingEffect( rotation = false, zoomInOut = false, colorChanger = false)` | |
| 98 | +| `customLoadingPadding` | Spacing between button border and loading icon. | `0` | |
| 99 | + |
| 100 | +## Customization |
| 101 | +* You can customize loading icon and animation effect according to your requirement.You can apply multiple animation effect from roationm, zoom-in-out and color changer. |
| 102 | + |
| 103 | + ```kotlin |
| 104 | + var submitButtonState by remember { mutableStateOf(SSButtonState.IDLE) } |
| 105 | + SSJetPackComposeProgressButton( |
| 106 | + type = SSButtonType.CLOCK, |
| 107 | + width = 300.dp, |
| 108 | + height = 50.dp, |
| 109 | + onClick = { |
| 110 | + //Perform action on click of button and make it state to LOADING |
| 111 | + submitButtonState = SSButtonState.LOADING |
| 112 | + }, |
| 113 | + assetColor = Color.Red, |
| 114 | + buttonState = submitButtonState, |
| 115 | + successIconPainter = painterResource(id = R.drawable.custom_success), |
| 116 | + failureIconPainter = painterResource(id = R.drawable.custom_fail), |
| 117 | + colors = ButtonDefaults.buttonColors(backgroundColor = Color.White), |
| 118 | + padding = PaddingValues(six.dp), |
| 119 | + text = stringResource(id = R.string.simform), |
| 120 | + textModifier = Modifier.padding(ten.dp), |
| 121 | + fontWeight = FontWeight.Bold, |
| 122 | + leftImagePainter = painterResource(id = R.drawable.simform_logo), |
| 123 | + buttonBorderStroke = BorderStroke(two.dp, colorResource(id = R.color.pink)), |
| 124 | + customLoadingIconPainter = painterResource(id = R.drawable.simform_logo), |
| 125 | + customLoadingEffect = SSCustomLoadingEffect( |
| 126 | + rotation = false, |
| 127 | + zoomInOut = true, |
| 128 | + colorChanger = false |
| 129 | + ) |
| 130 | + ) |
| 131 | + ``` |
| 132 | + ```kotlin |
| 133 | + // On Success change submitButtonState to success state |
| 134 | + submitButtonState = SSButtonState.SUCCESS |
| 135 | + ``` |
| 136 | + ```kotlin |
| 137 | + // On Failure change submitButtonState to failure state |
| 138 | + submitButtonState = SSButtonState.FAILIURE |
| 139 | + ``` |
| 140 | + |
| 141 | +# 🎬 Custom loading animation |
| 142 | + |
| 143 | +| On Success | On Failure | |
| 144 | +|--|--| |
| 145 | +|  |  | |
95 | 146 |
|
96 | 147 |
|
97 | 148 | ## Find this library useful? ❤️ |
|
0 commit comments