Skip to content

shruddms/Compose-SwipeView

Repository files navigation

Maven License

Compose-SwipeView is a scalable swipe view library made with Jetpack compose.

Attributes

Attribute Description
imageList image url or R.drawable.image ArrayList
imageScale Crop, Fit, Inside, FillHeight, FillWidth, None
infoSheetState sheet state when view is opened
infoContainerMaxHeight container max height
infoContainerMinHeight container min height
contentBackgroundColor container background color
contents @Composable fun

🤔 How to use it?

  1. Add the codes below to your root build.gradle file (not your module-level build.gradle file):
allprojects {
    repositories {
       maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency below to your module's build.gradle file:
dependencies {
     implementation 'com.github.shruddms:Compose-SwipeView:X.X.X'
}
  1. You can use simply by using function as the following example below:
private lateinit var imageList: ArrayList<Any>
ExpandSwipeView(
    imageList = imageList,
    imageScale = ContentScale.Crop,
    modifier = Modifier,
    infoSheetState = rememberSwipeableState(SheetState.Open),
    infoContainerMaxHeight = 600.dp,
    infoContainerMinHeight = 120.dp,
    contentBackgroundColor = MaterialTheme.colors.primary,
    contents = { content() }
)
@Composable
fun content() {
    Text(
        text = "Hello Word!",
        color = MaterialTheme.colors.onPrimary,
        style = MaterialTheme.typography.subtitle1,
        overflow = TextOverflow.Ellipsis,
        modifier = Modifier
            .padding(20.dp)
    )
}

Demo projects 🚀

This project using Compose-SwipeView library.
Surfing dummy data was used.

Preview ✨

* Swipe to expand

🌞 Light Mode

🌙 Dark Mode

Developed By

License

Copyright 2022 NoKyungEun

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.