Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/js-bhavyansh/material3_buttons
UI implementation of different types of material3 buttons
https://github.com/js-bhavyansh/material3_buttons
Last synced: 2 days ago
JSON representation
UI implementation of different types of material3 buttons
- Host: GitHub
- URL: https://github.com/js-bhavyansh/material3_buttons
- Owner: js-bhavyansh
- Created: 2024-06-02T08:51:33.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-06-02T15:19:54.000Z (6 months ago)
- Last Synced: 2024-10-21T10:02:03.625Z (about 1 month ago)
- Language: Kotlin
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Material Buttons in Jetpack Compose
This repository demonstrates the implementation of various Material Buttons using Jetpack Compose in an Android application. The examples include Normal Button, Elevated Button, FilledTonal Button, Outlined Button, and Text Button.
## Features
- **Normal Button**
- **Elevated/Shadow Button**
- **FilledTonal Button**
- **Outlined Button**
- **Text Button**Each button showcases different Material Design styles and behaviors.
## Screenshots
## Getting Started
1. Clone the repository:
```bash
git clone https://github.com/Bhavyansh03-tech/Material3_Buttons.git
```2. Open the project in Android Studio.
3. Build and run the app on your Android device or emulator.## Implementation
### 1. Normal Button
```kotlin
Button(
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary,
contentColor = Color.White
),
enabled = true,
onClick = {
Toast.makeText(context, "Normal Button", Toast.LENGTH_SHORT).show()
}
) {
Text(
text = "Normal Button"
)
}
```### 2. Elevated/Shadow Button
```kotlin
ElevatedButton(
onClick = {
Toast.makeText(context, "Elevated Button", Toast.LENGTH_SHORT).show()
}
) {
Icon(
imageVector = Icons.Outlined.Add,
contentDescription = "Add",
modifier = Modifier.size(18.dp)
)
Spacer(modifier = Modifier.width(8.dp))
Text(
text = "Add to cart"
)
}
```### 3. FilledTonal Button
```kotlin
FilledTonalButton(onClick = {
Toast.makeText(context, "Filled Button", Toast.LENGTH_SHORT).show()
}) {
Text(text = "Open in browser")
}
```### 4. Outlined Button
```kotlin
OutlinedButton(onClick = {
Toast.makeText(context, "Outlined Button", Toast.LENGTH_SHORT).show()
}) {
Text(text = "Back")
}
```### 5. Text Button
```kotlin
TextButton(onClick = {
Toast.makeText(context, "Text Button", Toast.LENGTH_SHORT).show()
}) {
Text(text = "Learn more")
}
```## Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
1.> Fork the Project.\
2.> Create your Feature Branch `git checkout -b feature/AmazingFeature`.\
3.> Commit your Changes `git commit -m 'Add some AmazingFeature'`.\
4.> Push to the Branch `git push origin feature/AmazingFeature`.\
5.> Open a Pull Request## Acknowledgements
- Inspiration from various Android development tutorials and documentation.
## ContactFor questions or feedback, please contact [@Bhavyansh03-tech](https://github.com/Bhavyansh03-tech).