|
| 1 | +import androidx.compose.foundation.background |
| 2 | +import androidx.compose.foundation.layout.Arrangement |
| 3 | +import androidx.compose.foundation.layout.Box |
| 4 | +import androidx.compose.foundation.layout.Column |
| 5 | +import androidx.compose.foundation.layout.IntrinsicSize |
| 6 | +import androidx.compose.foundation.layout.PaddingValues |
| 7 | +import androidx.compose.foundation.layout.Row |
| 8 | +import androidx.compose.foundation.layout.fillMaxSize |
| 9 | +import androidx.compose.foundation.layout.fillMaxWidth |
| 10 | +import androidx.compose.foundation.layout.height |
| 11 | +import androidx.compose.foundation.layout.padding |
| 12 | +import androidx.compose.foundation.layout.widthIn |
| 13 | +import androidx.compose.runtime.Composable |
| 14 | +import androidx.compose.ui.Alignment |
| 15 | +import androidx.compose.ui.Modifier |
| 16 | +import androidx.compose.ui.graphics.Brush |
| 17 | +import androidx.compose.ui.graphics.Color |
| 18 | +import androidx.compose.ui.text.style.TextAlign |
| 19 | +import androidx.compose.ui.unit.dp |
| 20 | +import top.yukonga.miuix.kmp.basic.Card |
| 21 | +import top.yukonga.miuix.kmp.basic.HorizontalDivider |
| 22 | +import top.yukonga.miuix.kmp.basic.Text |
| 23 | +import top.yukonga.miuix.kmp.basic.VerticalDivider |
| 24 | + |
| 25 | +@Composable |
| 26 | +fun DividerDemo() { |
| 27 | + Box( |
| 28 | + modifier = Modifier |
| 29 | + .fillMaxSize() |
| 30 | + .background(Brush.linearGradient(listOf(Color(0xfff77062), Color(0xfffe5196)))), |
| 31 | + contentAlignment = Alignment.Center |
| 32 | + ) { |
| 33 | + Column( |
| 34 | + Modifier |
| 35 | + .padding(16.dp) |
| 36 | + .widthIn(max = 600.dp) |
| 37 | + .fillMaxWidth(), |
| 38 | + verticalArrangement = Arrangement.spacedBy(16.dp), |
| 39 | + horizontalAlignment = Alignment.CenterHorizontally |
| 40 | + ) { |
| 41 | + Row( |
| 42 | + horizontalArrangement = Arrangement.spacedBy(32.dp), |
| 43 | + ) { |
| 44 | + Card( |
| 45 | + modifier = Modifier.weight(0.5f), |
| 46 | + insideMargin = PaddingValues(16.dp) |
| 47 | + ) { |
| 48 | + Text( |
| 49 | + text = "Content Above", |
| 50 | + modifier = Modifier.fillMaxWidth(), |
| 51 | + textAlign = TextAlign.Center |
| 52 | + ) |
| 53 | + HorizontalDivider( |
| 54 | + modifier = Modifier.padding(vertical = 8.dp), |
| 55 | + ) |
| 56 | + Text( |
| 57 | + text = "Content Below", |
| 58 | + modifier = Modifier.fillMaxWidth(), |
| 59 | + textAlign = TextAlign.Center |
| 60 | + ) |
| 61 | + } |
| 62 | + Card( |
| 63 | + modifier = Modifier.weight(0.5f), |
| 64 | + insideMargin = PaddingValues(16.dp) |
| 65 | + ) { |
| 66 | + Row( |
| 67 | + modifier = Modifier.height(IntrinsicSize.Min) |
| 68 | + ) { |
| 69 | + Text( |
| 70 | + text = "Left Content", |
| 71 | + modifier = Modifier.weight(1f), |
| 72 | + textAlign = TextAlign.Center |
| 73 | + ) |
| 74 | + VerticalDivider( |
| 75 | + modifier = Modifier.padding(horizontal = 8.dp), |
| 76 | + ) |
| 77 | + Text( |
| 78 | + text = "Right Content", |
| 79 | + modifier = Modifier.weight(1f), |
| 80 | + textAlign = TextAlign.Center |
| 81 | + ) |
| 82 | + } |
| 83 | + } |
| 84 | + } |
| 85 | + } |
| 86 | + } |
| 87 | +} |
0 commit comments