From fc69c3a010c9f7fa56463b83b9a86f5e210e4333 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 22 Oct 2026 07:26:49 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20open-lesson/presentation.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- open-lesson/presentation.md | 55 +++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/open-lesson/presentation.md b/open-lesson/presentation.md index b75799b..e49491f 100644 --- a/open-lesson/presentation.md +++ b/open-lesson/presentation.md @@ -58,6 +58,43 @@ | **C** | `DeckScreen.kt`, `MainActivity.kt` | экран и сборка | | **D** | `UiKit.kt`, `README.md` | цвета, `@Preview`, сборка | +--- +# Теория: `@Composable`, `Column`, `Row` + +```kotlin +@Composable +fun HelloScreen() { Text("Привет!") } + +Column { Text("Раз"); Text("Два") } + +Row(verticalAlignment = Alignment.CenterVertically) { + Text("Слева"); Text("Справа") +} +``` + +Имя — с большой буквы. Внутри — только другие `@Composable`. + +--- + +# Теория: `Modifier`, `Spacer`, `weight` + +`Modifier` — цепочка. **Порядок важен.** +`padding` до `background` — снаружи, после — внутри. + +```kotlin +Modifier.padding(8.dp).background(Color.Yellow).padding(12.dp) +``` + +`Spacer` — отступ: +```kotlin +Spacer(Modifier.height(12.dp)) +``` + +`weight(1f)` — только в `Row`/`Column`, делит свободное место: +```kotlin +Text(name, modifier = Modifier.weight(1f)) // HP отжимается вправо +``` + --- # Теория: `Card`, `Surface`, `@Preview` @@ -111,24 +148,6 @@ Spacer(Modifier.height(12.dp)) ```kotlin Text(name, modifier = Modifier.weight(1f)) // HP отжимается вправо ``` - ---- - -# Теория: `Card`, `Surface`, `@Preview` - -```kotlin -Surface(Modifier.fillMaxSize(), color = ...) { /* экран */ } - -Card( - shape = RoundedCornerShape(16.dp), - elevation = CardDefaults.cardElevation(...) -) { /* карта */ } - -@Preview(showBackground = true) -@Composable -fun P() { MaterialTheme { HelloScreen() } } -``` - --- # Новое: `data class`