mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 10:37:05 +05:30
android: integrate AndroidX Navigation
This commit is contained in:
parent
e053ca2028
commit
e85e25aa50
3 changed files with 19 additions and 9 deletions
|
@ -20,6 +20,7 @@ dependencies {
|
|||
implementation(libs.androidx.appcompat)
|
||||
implementation(libs.androidx.coreKtx)
|
||||
implementation(libs.androidx.lifecycle.compose)
|
||||
implementation(libs.androidx.navigation.compose)
|
||||
implementation(libs.androidx.paging.compose)
|
||||
implementation(libs.dagger.hilt.android)
|
||||
implementation(libs.sqldelight.extensions.coroutines)
|
||||
|
|
|
@ -20,6 +20,9 @@ import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
|||
import androidx.compose.ui.input.nestedscroll.NestedScrollSource
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.google.accompanist.insets.ProvideWindowInsets
|
||||
import com.google.accompanist.insets.navigationBarsPadding
|
||||
|
@ -40,6 +43,7 @@ fun LobstersApp(
|
|||
val systemUiController = rememberSystemUiController()
|
||||
val scaffoldState = rememberScaffoldState()
|
||||
val listState = rememberLazyListState()
|
||||
val navController = rememberNavController()
|
||||
var isFabVisible by remember { mutableStateOf(true) }
|
||||
val nestedScrollConnection = remember {
|
||||
object : NestedScrollConnection {
|
||||
|
@ -79,6 +83,8 @@ fun LobstersApp(
|
|||
)
|
||||
},
|
||||
) {
|
||||
NavHost(navController, startDestination = "hottest") {
|
||||
composable("hottest") {
|
||||
HottestPosts(
|
||||
items,
|
||||
listState,
|
||||
|
@ -92,3 +98,5 @@ fun LobstersApp(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ androidx-appcompat = "androidx.appcompat:appcompat:1.4.0-beta01"
|
|||
androidx-browser = "androidx.browser:browser:1.4.0-beta01"
|
||||
androidx-coreKtx = "androidx.core:core-ktx:1.7.0-beta02"
|
||||
androidx-lifecycle-compose = "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0-rc01"
|
||||
androidx-navigation-compose = "androidx.navigation:navigation-compose:2.4.0-alpha10"
|
||||
androidx-paging-compose = "androidx.paging:paging-compose:1.0.0-alpha13"
|
||||
|
||||
aurora-component = { module = "org.pushing-pixels:aurora-component", version.ref = "aurora" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue