All Projects โ†’ CuriousNikhil โ†’ neumorphic-compose

CuriousNikhil / neumorphic-compose

Licence: Apache-2.0 license
Neumorphism UI on Android with Jetpack Compose.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to neumorphic-compose

Notflix
Kotlin Multiplatform playground
Stars: โœญ 272 (+18.78%)
Mutual labels:  jetpack-compose
Fractal-Trees
Fractal Trees ๐ŸŒด using recursion | Demonstrated using Jetpack Compose ๐Ÿš€
Stars: โœญ 28 (-87.77%)
Mutual labels:  jetpack-compose
GitMessengerBot-Android
ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ, V8 ์—”์ง„์˜ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ, ํŒŒ์ด์ฌ ๊ทธ๋ฆฌ๊ณ  Git์„ ์ง€์›ํ•˜๋Š” ์ตœ์ฒจ๋‹จ ๋ฉ”์‹ ์ € ๋ด‡!
Stars: โœญ 51 (-77.73%)
Mutual labels:  jetpack-compose
Tachidesk-JUI
A Tachidesk Client built in Compose Multiplatform
Stars: โœญ 203 (-11.35%)
Mutual labels:  jetpack-compose
podcast-app
Podcast App
Stars: โœญ 291 (+27.07%)
Mutual labels:  jetpack-compose
ComposeTodo
Sample project to play with Jetpack Compose on Android, Desktop and Web
Stars: โœญ 64 (-72.05%)
Mutual labels:  jetpack-compose
ComposeNotes
Notes app with full jetpack compose architecture (UI + navigation). Uses MVVM, Room, Kotlin Flows & LiveData
Stars: โœญ 32 (-86.03%)
Mutual labels:  jetpack-compose
arkitekt
Arkitekt is a set of architectural tools based on Android Architecture Components, which gives you a solid base to implement the concise, testable and solid application.
Stars: โœญ 114 (-50.22%)
Mutual labels:  jetpack-compose
permissions-ui
Background location permissions request helper
Stars: โœญ 53 (-76.86%)
Mutual labels:  jetpack-compose
compose-ratingbar
A ratingbar composable for jetpack compose ๐Ÿš€๐ŸŒŸ
Stars: โœญ 89 (-61.14%)
Mutual labels:  jetpack-compose
Kuberam
Kuberam is built on jetpack compose + Auth0 during Hashnode Hackathon.
Stars: โœญ 33 (-85.59%)
Mutual labels:  jetpack-compose
MusicX
MusicX is a music player ๐ŸŽต android app built using Kotlin and Jetpack Compose. It follows M.A.D. practices and hence is a good learning resource for beginners
Stars: โœญ 85 (-62.88%)
Mutual labels:  jetpack-compose
Android-Developer-Roadmap
Ruta de aprendizaje desde cero para convertirte en Android Developer
Stars: โœญ 350 (+52.84%)
Mutual labels:  jetpack-compose
neon
Provides Jetpack Compose support for different image loading libraries.
Stars: โœญ 13 (-94.32%)
Mutual labels:  jetpack-compose
resaca
The right scope for View Models in Android Compose
Stars: โœญ 105 (-54.15%)
Mutual labels:  jetpack-compose
PexWallpapers
Android application following best practices: Jetpack, Jetpack Compose, Modularity, Clean Architecture, Kotlin Coroutines, Tests, MVVM, DI, Static Analysis
Stars: โœญ 86 (-62.45%)
Mutual labels:  jetpack-compose
Einsen
๐ŸŽฏ Einsen is a prioritization app that uses Eisenhower matrix technique as workflow to prioritize a list of tasks & built to Demonstrate use of Jetpack Compose with Modern Android Architecture Components & MVVM Architecture.
Stars: โœญ 821 (+258.52%)
Mutual labels:  jetpack-compose
compose chat
ไธ€ไธช็”จ Jetpack Compose ๅฎž็Žฐ็š„ IM APP
Stars: โœญ 158 (-31%)
Mutual labels:  jetpack-compose
make-react-native-package
CLI tool for bootstrapping react-native packages with Kotlin & Swift & Typescript
Stars: โœญ 36 (-84.28%)
Mutual labels:  jetpack-compose
SSJetpackComposeSwipeableView
SSJetpackComposeSwipeableView is a small library which provides support for the swipeable views. You can use this in your lazyColumns or can add a simple view which contains swipe to edit/delete functionality.
Stars: โœญ 57 (-75.11%)
Mutual labels:  jetpack-compose

Neumorphism UI with Jetpack Compose

This library is an experimentation with Neumorphism UI (New + Skeuomorphism) on Android with Jetpack Compose.

List of Awesome List Badge Awesome Kotlin Badge

How to use?

1. Add the dependency

And your app level build.gradle. (Make sure you have compose dependencies as well)

  implementation("me.nikhilchaudhari:composeNeumorphism:1.0.0-alpha02")

2. Use

Just add modifier = Modifier.neumorphic() to any of your UI element of Jetpack-Compose (just like you do for other modifiers).

image

How do I configure shape, color, etc.?

1. Shapes

You've three basic Neu shapes available -

  1. Punched, 2. Pressed, 3. Pot

These are not standard names for Neumorphism UI, I just named them based on how they look (at least to me).

And you can also configure the corner families of those shapes as Oval or Rounded

image

Card(
  backgroundColor = Color(236, 234, 235),
  shape = RoundedCornerShape(12.dp),
  modifier = Modifier
      .padding(16.dp)
      .size(300.dp, 100.dp)
      .neumorphic(
        neuShape = 
          // Punched shape
         Punched.Rounded(radius = 8.dp) 
         Punched.Oval()

         // Presssed Shape
         Pressed.Rounded(radius = 4.dp)
         Presssed.Oval()

        // Pot shape
        Pot.Rounded(radius = 8.dp)
        Pot.Oval()
      )
    ){/*card content */} 

For Rounded corner-family, you can configure the radius of how much rounded corner you want. The default Neu shape is Punched.Rounded(radius = 12.dp).
The Punched shape would work with Cards, Buttons, etc.
You should use Modifier.clip() while using Pressed shape, because there's known issue of shadow placeents for Pressed shape. Check the sample app for more code snippets.

P.S: Even I'm yet to experiment it with all UI elements.

2. Shadows

The idea of Neumorphism UI is simple, just create two shadows light and dark and draw those around the UI component from top-left and bottom-right corners.
Just make sure you are using the same colors for your Surface and for the UI elements. You can configure the shadow insets, color and elevation

Params Description
lightShadowColor Default value - Color.White - Set the light shadow color you want
darkShadowColor Default value - Color.Gray - Set the dark shadow color you want.
elevation Default value - 6.dp - Set the elevation for the shadow.
neuInsets Default values - NeuInsets(6.dp, 6.dp) - Insets = Horizontal, Vertical - Placements of your shadows i.e How do you want to place your
strokeWidth Default value - 6.dp - Stroke width of the internal shadows. Stroke width is for only Pressed and Punched.
  Button(
       onClick = { /*TODO*/ },
       modifier = Modifier
           .padding(12.dp)
           .neumorphic(
               // assing neuShape
               //...
               lightShadowColor = Color.White,
               darkShadowColor = Color.Gray,
               elevation = 4.dp,
               strokeWidth: Dp = 6.dp,
               neuInsets = NeuInsets(6.dp, 6.dp)
           )
   ) 

The overall configutation image

ToDos

  • Add LightSource option and place the shadows accordingly (It is, by default, top-left right now)
  • Migrate from RenderScript
  • Fix clipping and shadow positioning with insets
  • Update sample app and code with Jetpack-Compose guidelines

FAQs

What's the idea? Is there any performance overhead?

Idea is simple - just draw the two shadows light and dark around the UI element. I'm using RenderScript to blur two GradientDrawables. I know it's going to be deprecated in the Android 12. I'll surely update the code to migrate from RenderScript. If Renderscript throws any exception / not able to blur the drawable, I'm using StackBlur algorithm from Mario Klingemann as a workaround.

Does this library work with all the Jetpack Compose UI elements?

I can't surely say. I'm already experimenting drawing shadow on UIs with Jetpack Compose and improving this library. I request you to try and please help to make it work.

When can I use this?

You can use this right now if you want to play with shiny Neumorphism UI. The library is in alpha and there are some known issues regarding shadow rendering and clipping. Please raise issue if you found any.

Contribution Guide

Please contribute! I'm just getting my hands dirty with Jetpack-Compose.
There is heavy chance that the code may/may not be correct/holding best practices. I request you to contribute/ raise issues/ send PRs so I can learn too. You can use the Github Discussion to discuss and ask questions. Or you can reach out to me on Twitter @CuriousNikhil.

License

Licensed under Apache License, Version 2.0 here

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].