Skip to content

Commit

Permalink
added slider gif
Browse files Browse the repository at this point in the history
  • Loading branch information
charlee-dev committed Feb 26, 2022
1 parent 337c574 commit a0002cd
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 13 deletions.
14 changes: 8 additions & 6 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ MorphSwitch(
modifier = Modifier,
)
```
<img width="600" src="art/sliderl.png"><img width="600" src="art/sliderd.png">
<img width="600" src="art/sliderl.gif"><img width="600" src="art/sliderd.gif">
## Coming soon
Expand Down
Binary file added art/sliderd.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed art/sliderd.png
Binary file not shown.
Binary file added art/sliderl.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed art/sliderl.png
Binary file not shown.
7 changes: 4 additions & 3 deletions neumorph/src/main/kotlin/com/adwi/neumorph/android/Test.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.adwi.neumorph.android.components.PreviewTemplate
import com.adwi.neumorph.android.theme.MorphUiTheme
import com.adwi.neumorph.android.theme.AppColors

Expand All @@ -31,12 +32,12 @@ private fun TestDark() {
.background(MaterialTheme.colors.background)
.padding(10.dp),
) {
var value by remember { mutableStateOf(.5f)}
MorphSlider(
value = .6f,
onValueChange = {},
value = value,
onValueChange = {value = it},
elevation = 5.dp,
cornerRadius = 10.dp,
backgroundColor = MaterialTheme.colors.primary,
modifier = Modifier,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.adwi.neumorph.android.theme.MorphUiTheme

Expand All @@ -15,13 +16,15 @@ fun PreviewTemplate(
modifier: Modifier = Modifier,
darkTheme: Boolean = false,
name: String = "Composable",
content: @Composable (content: @Composable () -> Unit) -> Unit
content: @Composable (content: @Composable () -> Unit) -> Unit,
) {
MorphUiTheme(darkTheme = darkTheme) {
MorphBackground {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = modifier.fillMaxWidth().padding(24.dp)
modifier = modifier
.fillMaxWidth()
.padding(24.dp)
) {
content { SampleText(text = name) }
}
Expand All @@ -31,7 +34,7 @@ fun PreviewTemplate(

@Composable
fun SampleText(
text: String = "Morph UI"
text: String = "Morph UI",
) {
Box(
contentAlignment = Alignment.Center,
Expand All @@ -47,3 +50,27 @@ fun SampleText(
)
}
}

@Preview(showBackground = true, name = "Light", widthDp = 600, heightDp = 600)
@Composable
private fun PreviewTemplateLight() {
PreviewTemplate(
darkTheme = false,
) {
PreviewTemplate() {
it()
}
}
}

@Preview(showBackground = true, name = "Dark", widthDp = 600, heightDp = 600)
@Composable
private fun PreviewTemplateDark() {
PreviewTemplate(
darkTheme = true,
) {
PreviewTemplate() {
it()
}
}
}

0 comments on commit a0002cd

Please sign in to comment.