0Pricing
Jetpack Compose Academy · Ders

Compose Durum Yuvaları ve İçerik Lambda'ları

Slot API'leriyle bileşenleri esnek hâle getirin.

Compose Durum Yuvaları ve İçerik Lambda'ları, CoddyKit'te ücretsiz bir Jetpack Compose Academy dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Jetpack Compose Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Jetpack Compose Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Make Components Flexible

A slot lets a component accept a chunk of UI as a parameter. The caller fills the slot, so one component fits many designs.

Meet the content Lambda

The most common slot is a trailing content lambda of type @Composable () -> Unit. Whatever you put in braces becomes the body.

fun Card(content: @Composable () -> Unit) {
  Surface { content() }
}

Calling a Slot

You call the slot just like a normal lambda. Compose runs whatever UI the caller passed, right where you invoke content().

Card {
  Text("Anything I want lives here")
}

Why Slots Beat Booleans

Instead of many flags like showIcon or showTitle, expose slots. Callers compose exactly what they need, with full freedom.

Named Slots

Components can offer several slots, each a parameter. Scaffold does this with topBar, bottomBar, and content. 🧩

fun Banner(
  title: @Composable () -> Unit,
  action: @Composable () -> Unit
) { /* lay them out */ }

Scopes Add Power

A slot can be a receiver lambda, giving the caller helpers. Inside a Column, content is ColumnScope.() -> Unit so weight works.

fun MyColumn(content: @Composable ColumnScope.() -> Unit) {
  Column { content() }
}

Passing Data Into a Slot

Slots can hand values to the caller. A list row slot might pass the item so the caller decides how to draw it.

fun Row(item: User, content: @Composable (User) -> Unit) {
  content(item)
}

Slots Keep State Hoisted

Because the caller supplies the slot content, your component stays stateless about what is inside it. Ownership stays clear.

Reuse Across Screens

One Card or Dialog with slots replaces a dozen near-identical components. You build the frame once and vary the filling. ♻️

Default Slot Content

Give a slot a sensible default so simple callers can skip it, while advanced callers override it fully.

fun Section(
  header: @Composable () -> Unit = { Text("Section") },
  content: @Composable () -> Unit
) { /* ... */ }

The Slot Mindset

When a component starts collecting boolean flags, reach for slots instead. Flexibility comes from passing UI, not toggles.

Quick Check

What is the main benefit of a content slot lambda?

Recap

Slots accept UI as @Composable lambdas, optionally scoped or passing data. They make components flexible while keeping state hoisted. 🚀

Sıkça Sorulan Sorular

“Compose Durum Yuvaları ve İçerik Lambda'ları” dersi ücretsiz mi?

Evet — “Compose Durum Yuvaları ve İçerik Lambda'ları” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Jetpack Compose Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Jetpack Compose Academy kursu toplamda 4 dersten oluşur.

“Compose Durum Yuvaları ve İçerik Lambda'ları” dersinde ne öğreneceğim?

Slot API'leriyle bileşenleri esnek hâle getirin. Jetpack Compose Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Jetpack Compose Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Jetpack Compose Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.

“Compose Durum Yuvaları ve İçerik Lambda'ları” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Jetpack Compose Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Jetpack Compose Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Durumlu ve Durumsuz Composable'lar
  2. value ve onValueChange ile Durumu Yukarı Taşıma
  3. Tek Doğruluk Kaynağı
  4. Compose Durum Yuvaları ve İçerik Lambda'ları
← Jetpack Compose Academy Sayfasına Dön