Skip to content

Commit d4cbef6

Browse files
Merge pull request benjamin-luescher#7 from benjamin-luescher/feature/field_state_change_event
Make `changed` event public on Field and `options` mutable on FieldState
2 parents 29f36de + ddb7de0 commit d4cbef6

File tree

19 files changed

+77
-36
lines changed

19 files changed

+77
-36
lines changed

.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/deploymentTargetDropDown.xml

Lines changed: 18 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/kotlinc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/migrations.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencyResolutionManagement {
2323
2424
2. Add the dependency in your build.gradle file.
2525
```kotlin
26-
implementation 'com.github.benjamin-luescher:compose-form:0.2.3'
26+
implementation 'com.github.benjamin-luescher:compose-form:0.2.4'
2727
```
2828

2929
## Easy example

app/src/main/java/com/edorex/mobile/composeForm/MainActivity.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.edorex.mobile.composeForm
22

33
import android.annotation.SuppressLint
44
import android.os.Bundle
5+
import android.util.Log
56
import androidx.activity.ComponentActivity
67
import androidx.activity.compose.setContent
78
import androidx.compose.foundation.layout.*
@@ -17,6 +18,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
1718
import ch.benlu.composeform.fields.*
1819
import ch.benlu.composeform.formatters.dateLong
1920
import ch.benlu.composeform.formatters.dateShort
21+
import com.edorex.mobile.composeForm.models.Country
2022
import com.edorex.mobile.composeForm.ui.theme.ComposeFormTheme
2123
import dagger.hilt.android.AndroidEntryPoint
2224

@@ -56,6 +58,12 @@ fun FormPage() {
5658
label = "Name",
5759
form = viewModel.form,
5860
fieldState = viewModel.form.name,
61+
changed = {
62+
// log the name to show tat changed is called
63+
Log.d("Form", "Name changed: $it")
64+
// clear countries (for no reason - just to show that options list is now mutable)
65+
viewModel.form.country.options = mutableListOf()
66+
}
5967
).Field()
6068

6169
TextField(

0 commit comments

Comments
 (0)