Skip to content

Commit e79dc9c

Browse files
committed
Refactor TextBody and TransactionSection to improve layout and selection handling
1 parent d48208c commit e79dc9c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

library/src/commonMain/kotlin/ro/cosminmihu/ktor/monitor/ui/detail/body/TextBody.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package ro.cosminmihu.ktor.monitor.ui.detail.body
22

33
import androidx.compose.foundation.rememberScrollState
4-
import androidx.compose.foundation.text.selection.SelectionContainer
54
import androidx.compose.foundation.verticalScroll
65
import androidx.compose.material3.MaterialTheme
76
import androidx.compose.material3.Text
@@ -14,7 +13,9 @@ internal fun TextBody(
1413
text: AnnotatedString,
1514
modifier: Modifier = Modifier
1615
) {
17-
SelectionContainer(modifier = modifier.verticalScroll(rememberScrollState())) {
18-
Text(text = text, style = MaterialTheme.typography.bodyMedium)
19-
}
16+
Text(
17+
text = text,
18+
style = MaterialTheme.typography.bodyMedium,
19+
modifier = modifier.verticalScroll(rememberScrollState())
20+
)
2021
}

library/src/commonMain/kotlin/ro/cosminmihu/ktor/monitor/ui/detail/transaction/TransactionSection.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import androidx.compose.animation.AnimatedVisibility
44
import androidx.compose.foundation.layout.Column
55
import androidx.compose.foundation.layout.Row
66
import androidx.compose.foundation.layout.padding
7+
import androidx.compose.foundation.text.selection.SelectionContainer
78
import androidx.compose.material.icons.Icons
89
import androidx.compose.material.icons.filled.KeyboardArrowDown
910
import androidx.compose.material.icons.filled.KeyboardArrowUp
@@ -53,8 +54,10 @@ internal fun TransactionSection(
5354
}
5455

5556
AnimatedVisibility(show) {
56-
Column {
57-
content()
57+
SelectionContainer {
58+
Column {
59+
content()
60+
}
5861
}
5962
}
6063
}

0 commit comments

Comments
 (0)