Skip to content
项目

关于

A Jetpack Compose library that lets you add swipe-to-reveal behavior in both directions, exposing hidden content (icons, actions) behind your UI, with support for Material 3 and custom reveal directions.

网站与应用开发

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Build and test Lint Spotless CodeFactor Maven Central

RevealSwipe

RevealSwipe is a Compose UI component library built for swipe-to-reveal interactions. With this library, you can wrap content and reveal hidden composables (e.g. action icons) when swiping left or right.

[!NOTE]
🚀 RevealSwipe is now Compose Multiplatform

🧩 What it does

  • You can configure swipe directions (start → end, end → start).
  • For each direction, you can supply hidden content (e.g. an icon, button, or any composable).
  • The main content (your card, list item, etc.) slides over to reveal the hidden content beneath.
  • You remain in control over layout, styling, and when/if the reveal should trigger for a full swipe or partial swipe.
  • Works natively with Material 3 styling and theming.

Dependency

Add actual RevealSwipe library:

dependencies {
    implementation 'de.charlex.compose:revealswipe:3.1.0-rc02'
}

How does it work?

Surround your content with the RevealSwipe

RevealSwipe(
    modifier = Modifier.padding(vertical = 5.dp),
    directions = setOf(
//        RevealDirection.StartToEnd,
        RevealDirection.EndToStart
    ),
    hiddenContentStart = {
        Icon(
            modifier = Modifier.padding(horizontal = 25.dp),
            imageVector = Icons.Outlined.Star,
            contentDescription = null,
            tint = Color.White
        )
    },
    hiddenContentEnd = {
        Icon(
            modifier = Modifier.padding(horizontal = 25.dp),
            imageVector = Icons.Outlined.Delete,
            contentDescription = null
        )
    }
) {
    Card(
        modifier = Modifier.fillMaxSize().requiredHeight(80.dp),
        backgroundColor = Color(item.second),
        shape = it,
    ){
        Text(
            modifier = Modifier.padding(start = 20.dp, top = 20.dp),
            text = item.first
        )
    }
}

Preview

RevealSwipe

License

Copyright 2021 Alexander Karkossa

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

探索相关项目

加载中…