Giter VIP home page Giter VIP logo

compose-showcase's Introduction

Compose Showcase

platform license

A library for showcasing your feature in Jetpack Compose.

๐Ÿ Sequence Showcase

version

Creating a sequence of showcases in a specific order.

preview

Installation

  • Gradle
    implementation("io.github.jocoand:showcase-sequence:1.0.0")
    

Usage

  • Create your Showcase dialog

  •   @Composable
      fun MyShowcaseDialog(text: String, onClick: () -> Unit) {
          Column(
              modifier = Modifier
                  .background(Color.White, shape = RoundedCornerShape(12.dp))
                  .padding(16.dp),
              verticalArrangement = Arrangement.Center,
              horizontalAlignment = Alignment.End
          ) {
              Text(text = text)
              Spacer(modifier = Modifier.height(8.dp))
              Button(
                  shape = RoundedCornerShape(8.dp),
                  onClick = onClick
              ) {
                  Text("Nice !")
              }
          }
      }
    
  • Declare the SequenceShowcase & sequenceShowcaseState

  • val sequenceShowcaseState = rememberSequenceShowcaseState()
    
    SequenceShowcase(state = sequenceShowcaseState) {
        Scaffold(
          ...
    
  • Mark your target view with sequenceShowcaseTarget modifier

  •   // View to be highlighted
      MyView1(
        modifier = Modifier
            .sequenceShowcaseTarget(
                index = 0,
                content = {
                    MyShowcaseDialog(
                        text = "Hey, this is Greetings showcase",
                    )
                }
            ),
        onClick = { sequenceShowcaseState.start() }
      )
    

    Assign index value to mark the order to be shown in the sequence

    Assign content value with your dialog

  • Use SequenceShowcaseState.start() to start the showcase

  •   LaunchButton(
          ...
          onClick = { sequenceShowcaseState.start() }
      )
    

    Assign optional index value to start at certain index

  • Use SequenceShowcaseState.next() to navigate to the next showcase

  •   MyView2(
          modifier = Modifier
              .sequenceShowcaseTarget(
                  index = 1,
                  content = {
                      MyShowcaseDialog(
                          text = "Hey, this is Article show case",
                          onClick = {
                            sequenceShowcaseState.next() // Navigate to next showcase
                          } 
                      )
                  }
              )
      )
    
  • You can also dismiss the the showcase using dimiss()

  • See sample for more more details

Config

  • position

    Top Bottom

    Default: relative to target position

  • alignment

    Start Center End

    Default: relative to target position

Inspired by ๐Ÿ’ก

Sample ๐ŸŽจ

๐ŸŒ€ ShowcaseView

version

In case you need more basic usage, you can you use ShowcaseView

Contributing

Contribution are welcome! Feel free to open an issue or a pull request, if you find any bugs or have any suggestions.

compose-showcase's People

Contributors

jocoand avatar

Stargazers

Kevin Tan avatar Angry Ronald avatar

Watchers

 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.