Sha256: 21129c7d950b7d9421ec710e12a3e54e6fda7d39553ca096c041ad4d4a5acac6

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

package <%= package_name %>.features.native

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.Divider
import androidx.compose.material3.ListItem
import androidx.compose.material3.Text
import dev.hotwire.turbo.nav.TurboNavGraphDestination
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview

@TurboNavGraphDestination(uri = "turbo://fragment/numbers")
class NumbersFragment : NativeFragment() {
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return setContent(inflater, container) {
            NumbersList()
        }
    }
}

@Composable
fun NumbersList() {
    val numbers = 1..100

    LazyColumn {
        items(numbers.count()) { index ->
            ListItem(headlineContent = { Text("Row number ${index + 1}") })
            Divider()
        }
    }
}

@Preview
@Composable
fun PreviewNumbersList() {
    NumbersList()
}

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
turbo-native-initializer-0.0.3 lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NumbersFragment.kt.tt
turbo-native-initializer-0.0.3 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NumbersFragment.kt.tt