|
1 | | -# android-morphing-button-jetpack-compose |
| 1 | +# SSJetPackComposeProgressButton |
| 2 | +### _SSJetPackComposeProgressButton is an elegant button with a different loading animations._ |
| 3 | + |
| 4 | +[][git-repo-url] [](https://jitpack.io/#SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose) [](https://kotlinlang.org) [](https://www.android.com/) [](https://android-arsenal.com/api?level=21) |
| 5 | + |
| 6 | +## Features |
| 7 | +- Android’s modern toolkit - Jetpack Compose support. |
| 8 | +- Newly designed loading animation make your app atterective. |
| 9 | +- Blinking icon button for your hot-feature |
| 10 | +- Button with text, right and left icon |
| 11 | +- Different types of state makes it easy to manage button. (Idle, Loading, Success, failure) |
| 12 | +- Fully customized button (Corner radius, background, colors, animation speed etc.) |
| 13 | + |
| 14 | +# 🎬 Preview |
| 15 | + |
| 16 | +| On Success | On Failure | |
| 17 | +|--|--| |
| 18 | +|  |  | |
| 19 | + |
| 20 | +## Installation |
| 21 | +1. Add it in your root build.gradle at the end of repositories: |
| 22 | + |
| 23 | + ```groovy |
| 24 | + allprojects { |
| 25 | + repositories { |
| 26 | + ... |
| 27 | + maven { url 'https://jitpack.io' } |
| 28 | + } |
| 29 | + } |
| 30 | + ``` |
| 31 | + |
| 32 | +* Add the dependency in your app's build.gradle file |
| 33 | + |
| 34 | + ```groovy |
| 35 | + dependencies { |
| 36 | + implementation 'com.github.SimformSolutionsPvtLtd:android-morphing-button-jetpack-compose:Tag' |
| 37 | + } |
| 38 | + ``` |
| 39 | + |
| 40 | +## Usage |
| 41 | +* Just use SSLoadingButton where you want button. |
| 42 | + |
| 43 | + ```kotlin |
| 44 | + var submitButtonState by remember { mutableStateOf(SSButtonState.IDLE) } |
| 45 | + SSLoadingButton( |
| 46 | + type = SSButtonType.CLOCK, |
| 47 | + width = 300.dp, |
| 48 | + height = 50.dp, |
| 49 | + onClick = { |
| 50 | + //Perform action on click of button and make it state to LOADING |
| 51 | + submitButtonState = SSButtonState.LOADING |
| 52 | + }, |
| 53 | + assetColor = Color.Red, |
| 54 | + buttonState = submitButtonState |
| 55 | + ) |
| 56 | + ``` |
| 57 | + ```kotlin |
| 58 | + // On Success change submitButtonState to success state |
| 59 | + submitButtonState = SSButtonState.SUCCESS |
| 60 | + ``` |
| 61 | + ```kotlin |
| 62 | + // On Failure change submitButtonState to failure state |
| 63 | + submitButtonState = SSButtonState.FAILIURE |
| 64 | + ``` |
| 65 | +### All Attributes |
| 66 | +------------------------ |
| 67 | + |
| 68 | +| Attribute | Description | Default | |
| 69 | +| --- | --- | --- | |
| 70 | +| `type` | Choose type of animation from:[CIRCLE, WHEEL, ZOOM_IN_OUT_CIRCLE, CLOCK, SPIRAL] | None | |
| 71 | +| `width` | Width to be applied to the button. | None | |
| 72 | +| `height` | Height to be applied to the button. | None | |
| 73 | +| `onClick` | Will be called when the user clicks the button. | None | |
| 74 | +| `assetColor` | Color to be applied to icon and text inside button. | None | |
| 75 | +| `buttonState` | Represent the state of button from IDLE, LOADING, SUCCESS, FAILIURE from SSButtonState. | None | |
| 76 | +| `buttonBorderStroke` | Border to draw around the button. | None | |
| 77 | +| `blinkingIcon` | Icon will be blink with size and color. | `false` | |
| 78 | +| `cornerRadius` | Corner radius to be applied to the button. | `20` | |
| 79 | +| `speedMillis` | Speed of the animation while changing the state. | `1000` | |
| 80 | +| `enabled` | Controls the enabled state of the button. | `true` | |
| 81 | +| `elevation` | It is used to resolve the elevation for this button in different. | `ButtonDefaults.elevation()` | |
| 82 | +| `colors` | Colors that will be used to resolve the background and content color for this button in different states | `ButtonDefaults.buttonColors()` | |
| 83 | +| `padding` | The spacing values to apply internally between the container and the content. | `PaddingValues(0.dp)` | |
| 84 | +| `alphaValue` | The alpha of the drawn area. | `1f` | |
| 85 | +| `leftImagePainter` | Painter to draw inside this left Icon. | `null` | |
| 86 | +| `rightImagePainter` | Painter to draw inside this right Icon. | `null` | |
| 87 | +| `successIconPainter` | Painter to draw inside this success state Icon. | `rememberVectorPainter(image = Icons.Default.Done)` | |
| 88 | +| `failureIconPainter` | Painter to draw inside this failiure state Icon. | `rememberVectorPainter(image = Icons.Outlined.Info)` | |
| 89 | +| `text` | The text to be displayed. | `null` | |
| 90 | +| `textModifier` | To apply to this text layout node. | `Modifier` | |
| 91 | +| `fontSize` | The size of glyphs to use when painting the text. | `TextUnit.Unspecified` | |
| 92 | +| `fontStyle` | The typeface variant to use when drawing the letters (e.g., italic). | `null` | |
| 93 | +| `fontFamily` | The font family to be used when rendering the text. | `null` | |
| 94 | +| `hourHandColor` | Color will be apply to hour hand in clock type animation only. | `Color.Black` | |
| 95 | + |
| 96 | + |
| 97 | +## Find this library useful? ❤️ |
| 98 | +Support it by joining __[stargazers]__ for this repository.⭐ |
| 99 | + |
| 100 | +## 🤝 How to Contribute |
| 101 | + |
| 102 | +Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪 |
| 103 | +Check out our __[Contributing Guide]__ for ideas on contributing. |
| 104 | + |
| 105 | +## Bugs and Feedback |
| 106 | +For bugs, feature requests, and discussion please use __[GitHub Issues]__. |
| 107 | + |
| 108 | +## License |
| 109 | +``` |
| 110 | +Copyright 2021 Simform Solutions |
| 111 | +
|
| 112 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 113 | + you may not use this file except in compliance with the License. |
| 114 | + You may obtain a copy of the License at |
| 115 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 116 | + Unless required by applicable law or agreed to in writing, software |
| 117 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 118 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 119 | + See the License for the specific language governing permissions and limitations under the License. |
| 120 | +``` |
| 121 | + |
| 122 | +[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax) |
| 123 | + [git-repo-url]: <https://github.com/SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose.git> |
| 124 | + [stargazers]: <https://github.com/SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose/stargazers> |
| 125 | + [Contributing Guide]: <https://github.com/SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose/blob/main/CONTRIBUTING.md> |
| 126 | + [GitHub Issues]: <https://github.com/SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose/issues> |
0 commit comments