File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed
app/src/main/java/com/example/nav3recipes/passingarguments Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package com.example.nav3recipes.passingarguments.basicviewmodels
19
19
import android.os.Bundle
20
20
import androidx.activity.ComponentActivity
21
21
import androidx.activity.compose.setContent
22
+ import androidx.compose.foundation.lazy.LazyColumn
22
23
import androidx.compose.material3.Button
23
24
import androidx.compose.material3.Text
24
25
import androidx.compose.runtime.Composable
@@ -65,11 +66,13 @@ class BasicViewModelsActivity : ComponentActivity() {
65
66
entryProvider = entryProvider {
66
67
entry<RouteA > {
67
68
ContentGreen (" Welcome to Nav3" ) {
68
- for (i in 0 .. 10 ){
69
- Button (onClick = {
70
- backStack.add(RouteB (" $i " ))
71
- }) {
72
- Text (" $i " )
69
+ LazyColumn {
70
+ items(10 ) { i ->
71
+ Button (onClick = {
72
+ backStack.add(RouteB (" $i " ))
73
+ }) {
74
+ Text (" $i " )
75
+ }
73
76
}
74
77
}
75
78
}
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package com.example.nav3recipes.passingarguments.injectedviewmodels
19
19
import android.os.Bundle
20
20
import androidx.activity.ComponentActivity
21
21
import androidx.activity.compose.setContent
22
+ import androidx.compose.foundation.lazy.LazyColumn
22
23
import androidx.compose.material3.Button
23
24
import androidx.compose.material3.Text
24
25
import androidx.compose.runtime.Composable
@@ -34,6 +35,7 @@ import androidx.navigation3.ui.NavDisplay
34
35
import androidx.navigation3.ui.rememberSceneSetupNavEntryDecorator
35
36
import com.example.nav3recipes.content.ContentBlue
36
37
import com.example.nav3recipes.content.ContentGreen
38
+ import com.example.nav3recipes.passingarguments.basicviewmodels.RouteB
37
39
import com.example.nav3recipes.ui.setEdgeToEdgeConfig
38
40
import dagger.assisted.Assisted
39
41
import dagger.assisted.AssistedFactory
@@ -71,11 +73,13 @@ class InjectedViewModelsActivity : ComponentActivity() {
71
73
entryProvider = entryProvider {
72
74
entry<RouteA > {
73
75
ContentGreen (" Welcome to Nav3" ) {
74
- for (i in 0 .. 10 ){
75
- Button (onClick = {
76
- backStack.add(RouteB (" $i " ))
77
- }) {
78
- Text (" $i " )
76
+ LazyColumn {
77
+ items(10 ) { i ->
78
+ Button (onClick = {
79
+ backStack.add(RouteB (" $i " ))
80
+ }) {
81
+ Text (" $i " )
82
+ }
79
83
}
80
84
}
81
85
}
You can’t perform that action at this time.
0 commit comments