File tree Expand file tree Collapse file tree 1 file changed +29
-25
lines changed
src/main/kotlin/com/hoc081098/kotlin_playground/compose Expand file tree Collapse file tree 1 file changed +29
-25
lines changed Original file line number Diff line number Diff line change @@ -7,40 +7,44 @@ import androidx.compose.runtime.Composable
7
7
import androidx.compose.ui.window.singleWindowApplication
8
8
9
9
fun main () {
10
+ val demo = Demo ()
10
11
singleWindowApplication {
11
- MyComposable ()
12
+ demo. MyComposable ()
12
13
}
13
14
}
14
15
15
- fun func1 () {
16
- println (" Func 1" )
17
- }
18
-
19
- fun func2 (i : Int ) {
20
- println (" Func 2: $i " )
21
- }
22
-
23
- @Composable
24
- fun MyComposable () {
25
- val func3 = {
26
- println (" Func 3" )
16
+ class Demo {
17
+ private fun func1 () {
18
+ println (" Func 1" )
27
19
}
28
- val func4 = { i: Int ->
29
- println (" Func 4: $i " )
20
+
21
+ private fun func2 (i : Int ) {
22
+ println (" Func 2: $i " )
30
23
}
31
24
32
- Column {
33
- Button (onClick = ::func1) {
34
- Text (" Func 1" )
35
- }
36
- Button (onClick = { func2(1 ) }) {
37
- Text (" Func 2" )
25
+ @Composable
26
+ fun MyComposable () {
27
+ val func3 = {
28
+ println (" Func 3" )
38
29
}
39
- Button (onClick = func3) {
40
- Text (" Func 3 " )
30
+ val func4 = { i : Int ->
31
+ println (" Func 4: $i " )
41
32
}
42
- Button (onClick = { func4(1 ) }) {
43
- Text (" Func 4" )
33
+
34
+ Column {
35
+ Button (onClick = ::func1) {
36
+ Text (" Func 1" )
37
+ }
38
+ Button (onClick = { func2(1 ) }) {
39
+ Text (" Func 2" )
40
+ }
41
+ Button (onClick = func3) {
42
+ Text (" Func 3" )
43
+ }
44
+ Button (onClick = { func4(1 ) }) {
45
+ Text (" Func 4" )
46
+ }
44
47
}
45
48
}
49
+
46
50
}
You can’t perform that action at this time.
0 commit comments