File tree Expand file tree Collapse file tree 3 files changed +96
-22
lines changed
desktop-gui/compose/src/main/kotlin Expand file tree Collapse file tree 3 files changed +96
-22
lines changed Original file line number Diff line number Diff line change 1
1
import androidx.compose.desktop.ui.tooling.preview.Preview
2
- import androidx.compose.foundation.layout.Column
3
2
import androidx.compose.foundation.layout.Row
4
- import androidx.compose.foundation.lazy.LazyColumn
5
- import androidx.compose.material.Button
6
3
import androidx.compose.material.MaterialTheme
7
- import androidx.compose.material.Text
8
4
import androidx.compose.runtime.*
9
5
import androidx.compose.ui.window.Window
10
6
import androidx.compose.ui.window.application
7
+ import view.ContentView
8
+ import view.ToolsView
11
9
12
10
@Composable
13
11
@Preview
14
12
fun App () {
15
- var text by remember { mutableStateOf(" Hello, World! " ) }
13
+ var tool by remember { mutableStateOf(" tool " ) }
16
14
17
15
MaterialTheme {
18
16
Row {
19
- Column {
20
- Row {
21
- Text (" Tools" )
22
- }
23
- Row {
24
- LazyColumn {
25
- items(5 ) {
26
- Row { Button (onClick = { println (" $it " ) }) {
27
- Text (" Hello, $it " )
28
- } }
29
- }
30
- }
31
- }
32
- }
33
- Column {
34
- Text (" Contents" )
35
- }
17
+ ToolsView ()
18
+ ContentView ()
36
19
}
37
20
38
21
}
Original file line number Diff line number Diff line change
1
+ package view
2
+
3
+ import androidx.compose.desktop.ui.tooling.preview.Preview
4
+ import androidx.compose.foundation.layout.*
5
+ import androidx.compose.material.Divider
6
+ import androidx.compose.material.Text
7
+ import androidx.compose.runtime.Composable
8
+ import androidx.compose.ui.Alignment
9
+ import androidx.compose.ui.Modifier
10
+ import androidx.compose.ui.graphics.Color
11
+ import androidx.compose.ui.unit.Dp
12
+ import androidx.compose.ui.unit.dp
13
+
14
+ @Preview
15
+ @Composable
16
+ fun ContentView () {
17
+ Column (
18
+ Modifier .fillMaxSize(),
19
+ horizontalAlignment = Alignment .CenterHorizontally
20
+ ) {
21
+ Row (
22
+ modifier = Modifier .height(Dp (30F )),
23
+ verticalAlignment = Alignment .CenterVertically
24
+ ) {
25
+ Text (" Contents" )
26
+ }
27
+ Row (modifier = Modifier .padding(2 .dp)) {
28
+ Divider (
29
+ color = Color .LightGray ,
30
+ modifier = Modifier .fillMaxWidth().height(1 .dp)
31
+ )
32
+ }
33
+ Row {
34
+ Text (" Content" )
35
+ }
36
+ }
37
+ }
Original file line number Diff line number Diff line change
1
+ package view
2
+
3
+ import androidx.compose.desktop.ui.tooling.preview.Preview
4
+ import androidx.compose.foundation.layout.*
5
+ import androidx.compose.foundation.lazy.LazyColumn
6
+ import androidx.compose.material.Button
7
+ import androidx.compose.material.Divider
8
+ import androidx.compose.material.Text
9
+ import androidx.compose.runtime.Composable
10
+ import androidx.compose.ui.Modifier
11
+ import androidx.compose.ui.graphics.Color
12
+ import androidx.compose.ui.text.style.TextAlign
13
+ import androidx.compose.ui.unit.dp
14
+
15
+ @Composable
16
+ @Preview
17
+ fun ToolsView () {
18
+ Column {
19
+ Row {
20
+ Row {
21
+ Column (modifier = Modifier .width(120 .dp)) {
22
+ Row {
23
+ Text (
24
+ " Tools" ,
25
+ textAlign = TextAlign .Center ,
26
+ modifier = Modifier .fillMaxWidth()
27
+ )
28
+
29
+ }
30
+ Row {
31
+ LazyColumn {
32
+ items(5 ) {
33
+ Row (
34
+ Modifier .fillMaxWidth(),
35
+ horizontalArrangement = Arrangement .SpaceEvenly
36
+ ) {
37
+ Button (onClick = { println (" $it " ) }) {
38
+ Text (" Hello, $it " )
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ Column (modifier = Modifier .width(2 .dp)) {
46
+ Divider (
47
+ color = Color .LightGray ,
48
+ modifier = Modifier .fillMaxHeight().width(1 .dp)
49
+ )
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
You can’t perform that action at this time.
0 commit comments