Skip to content

Commit

Permalink
Add corner
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom committed Jan 4, 2024
1 parent 20ed460 commit f9b9948
Showing 1 changed file with 38 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CornerSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -65,39 +68,44 @@ class FirstFragment : Fragment() {
@Composable
fun SampleComposableFunction() {
var count by remember { mutableStateOf(2) }
Column(
Modifier
.testTag("MyColumn")
Surface(
shape = RoundedCornerShape(corner = CornerSize(8.dp)),
color = MaterialTheme.colorScheme.primaryContainer,
) {
Text(
text = "Add",
Column(
Modifier
.testTag("AddBoxButton")
.background(Color.Gray)
.clickable {
count++
}
)
Text(
text = "Sub",
Modifier
.testTag("SubBoxButton")
.background(Color.Gray, MaterialTheme.shapes.medium)
.clickable {
count--
}
)
(0 until count).forEach { index ->
Box(
.testTag("MyColumn")
) {
Text(
text = "Add",
Modifier
.border(1.dp, Color.Gray, MaterialTheme.shapes.small)
.background(Color.Red)
.testTag("child:$index")
.size(32.dp)
){
Text(
text = "$index/$count"
)
.testTag("AddBoxButton")
.background(Color.Gray)
.clickable {
count++
}
)
Text(
text = "Sub",
Modifier
.testTag("SubBoxButton")
.background(Color.Gray, MaterialTheme.shapes.medium)
.clickable {
count--
}
)
(0 until count).forEach { index ->
Box(
Modifier
.border(1.dp, Color.Gray, MaterialTheme.shapes.small)
.background(Color.Red)
.testTag("child:$index")
.size(32.dp)
) {
Text(
text = "$index/$count"
)
}
}
}
}
Expand Down

0 comments on commit f9b9948

Please sign in to comment.