Giter Site home page Giter Site logo

afalabarce / shapes-for-jetpackcompose Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xavijimenezmulet/shapes-for-jetpackcompose

3.0 0.0 0.0 144 KB

The Compose Shapes Repository is a collection of shape utilities and custom shapes designed specifically for use with Jetpack Compose. This repository aims to provide a comprehensive set of pre-defined shapes that can be easily used and customized in your Compose UI projects.

License: Apache License 2.0

Kotlin 100.00%

shapes-for-jetpackcompose's Introduction

Compose Shapes Repository

Download API Build Status PR Welcome Language ktlint Open Source Love License

ko-fi

The Compose Shapes Repository is a collection of shape utilities and custom shapes designed specifically for use with Jetpack Compose. This repository aims to provide a comprehensive set of pre-defined shapes that can be easily used and customized in your Compose UI projects.

Features

  • Ready-to-use Shapes: The repository offers a wide range of pre-defined shapes such as circles, rectangles, triangles, stars, and more. These shapes can be directly used in your Compose UI code, saving you time and effort.

  • Custom Shape Generators: The repository includes utility functions and generators that allow you to create custom shapes with various parameters, such as radius, corner radius, angles, and more. These generators provide flexibility and enable you to create unique and visually appealing shapes.

  • Shape Extensions: The repository provides extensions for the Modifier class in Compose, allowing you to apply shapes to different Compose components easily. These extensions simplify the process of applying shapes and provide a seamless integration with the Compose UI framework.

  • Documentation and Examples: Each shape in the repository comes with detailed documentation and usage examples, making it easy for developers to understand and utilize the shapes effectively in their projects. The documentation includes information about available customization options and recommendations for best practices.

Getting Started

To get started with the Compose Shapes Repository, simply clone the repository and import the desired shape utilities or custom shapes into your Compose project. You can then use these shapes in your Compose UI code by applying them to the appropriate components using the provided extensions.

allprojects {
	repositories {
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency:

dependencies {
	implementation "com.github.xavijimenezmulet:shapes-for-jetpackcompose:$latest_version"
}

Simple usage:

val HeartShape: Shape = object : Shape {
    override fun createOutline(
        size: Size,
        layoutDirection: LayoutDirection,
        density: Density
    ): Outline {
        val path = Path().apply {
            heartPath(size = size)
            close()
        }
        return Outline.Generic(path)
    }
}

Now with preview:

@Preview
@Composable
fun HeartPreview() {
    Column(
        modifier = Modifier.fillMaxSize(),
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        Box(
            modifier = Modifier
                .size(100.dp)
                .clip(HeartShape)
                .background(Color.Yellow)
        )
    }
}

Any help to collect shapes and improve the code will be welcome.

shapes-for-jetpackcompose's People

Contributors

xavijimenezmulet avatar

Stargazers

David Navarro avatar Daniel Ávila Domingo avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.