8000 GitHub - cybernetics/Compose-Debug-Drawer: DebugDrawer for and made by Jetpack Compose
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cybernetics/Compose-Debug-Drawer

Debug Drawer for Jetpack Compose

Composable Debug Drawer for Jetpack Compose apps

Install

Configure jitpack:

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

Add dependencies:

implementation 'com.github.alorma.Compose-Debug-Drawer:drawer-base:0.1.0-beta-06'
implementation 'com.github.alorma.Compose-Debug-Drawer:drawer-modules:0.1.0-beta-06'
implementation 'com.github.alorma.Compose-Debug-Drawer:developer-shortcuts:0.1.0-beta-06'

Setup

Wrap your content with DebugDrawerLayout:

DebugDrawerLayout(
  debug = { BuildConfig.DEBUG },
  drawerModules = {
    TODO()
  }

) {
  // TODO Add your APP Content here
}

This library automatically handles the debug / release state, so no need to remove the drawer on Release builds

Modules

Add modules as a list of DebugModules

DebugDrawerLayout(
  debug = { BuildConfig.DEBUG },
  drawerModules = {
    listOf(DeviceModule(), BuildModule())
  }
) {
  // TODO Add your APP Content here
}

Actions Module

This module receive a List<DebugDrawerAction>

Actions

  • ButtonAction: Shows a Button with given text, and register a lambda to receive it's click

  • SwitchAction: Shows a Switch and register a lambda to receive it's changes

All DebugDrawerAction can modify it's default UI by pass a modifier

Build Module

Shows information about the app: Version code, Version name and Package

Device Module

Shows information about device running the app such as Device, and manufacturer

Shortcuts Module

Some quick shortcuts to open common developer tools.

Missing any? Open an issue here

Custom Module

You can create your own module by creating a class that extends: DrawerModule

class UserModule : DebugModule {
    override val icon: IconType
    override val title: String = 

    @Composable
    override fun build() {
        TODO()
    }
}

Theming && Customization

Use drawerColors to customize drawer theme colors

DebugDrawerLayout(
     drawerColors = YourColorScheme,
)

Custom Modules

Any module has access to DrawerColors and must use it to match the colors used by modules from this library

Modules list UI

Update module UI by pass Modifier

DebugDrawerLayout(
    moduleModifier = Modifier
        .padding()
        .clip()
        .border(),
)

About

DebugDrawer for and made by Jetpack Compose

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

0