Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Commit de6ae78

Browse files
committed
add screenshot
1 parent 1a18603 commit de6ae78

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[kotlin-version](https://img.shields.io/badge/kotlin-1.4.31-orange)
1+
![kotlin-version](https://img.shields.io/badge/kotlin-1.5.31-orange)
22
[![](https://jitpack.io/v/devscast/validable.svg)](https://jitpack.io/#devscast/validable)
33

44
# validable
@@ -9,34 +9,37 @@ Validable is an extensible library that allows you to validate your text fields
99

1010
This is what it looks like :
1111

12+
<img src="screenshots/inputscreen.png?raw=true" width="220" alt="Welcome screen">
13+
1214
```kotlin
1315
@Composable
1416
fun MyScreen() {
1517

1618
val emailField = remember { EmailValidable() }
1719

18-
TextField(
19-
value = emailField.value,
20-
onValueChange = { emailField.value = it }, // update the text
21-
isError = emailField.hasError(), // check if the field is not valid
20+
TextField(
21+
value = emailField.value,
22+
onValueChange = { emailField.value = it }, // update the text
23+
isError = emailField.hasError(), // check if the field is not valid
2224
)
2325

24-
AnimatedVisibility(visible = emailField.hasError() {
26+
AnimatedVisibility(visible = emailField.hasError()) {
2527

2628
Text(
27-
text = emailField.errorMessage ?: "",
28-
modifier = Modifier.fillMaxWidth(),
29-
style = LocalTextStyle.current.copy(color = MaterialTheme.colors.error)
30-
)
29+
text = emailField.errorMessage ?: "",
30+
modifier = Modifier.fillMaxWidth(),
31+
style = LocalTextStyle.current.copy(color = MaterialTheme.colors.error)
32+
)
3133

3234
}
3335

3436
Button(onClick = {
35-
// pass all fields to the withValidable method
36-
withValidable(emailField) {
37+
// pass all fields to the withValidable method
38+
withValidable(emailField) {
3739

38-
// will be executed if all fields are valid
39-
Toast.makeText(context,"All fields are valid",Toast.LENGTH_SHORT).show()
40+
// will be executed if all fields are valid
41+
Toast.makeText(context,"All fields are valid",Toast.LENGTH_SHORT).show()
42+
4043
}
4144
}) {
4245
Text(text = "Submit")
@@ -69,4 +72,4 @@ dependencies {
6972

7073
The latest version of this library is [![](https://jitpack.io/v/devscast/validable.svg)](https://jitpack.io/#devscast/validable)
7174

72-
## For full documentation, check out the [wiki](https://github.com/devscast/validable/wiki) page
75+
## For full documentation, check out the [wiki](https://github.com/devscast/validable/wiki) page

screenshots/inputscreen.png

80.6 KB
Loading

0 commit comments

Comments
 (0)