Wrap Detail in bottomsheet
This commit is contained in:
parent
0f2b50f42e
commit
e6d7694f67
4 changed files with 28 additions and 21 deletions
|
|
@ -105,9 +105,10 @@ dependencies {
|
||||||
kapt "com.google.dagger:hilt-compiler:2.40.5"
|
kapt "com.google.dagger:hilt-compiler:2.40.5"
|
||||||
|
|
||||||
// Accompanist
|
// Accompanist
|
||||||
implementation "com.google.accompanist:accompanist-systemuicontroller:0.24.3-alpha"
|
implementation "com.google.accompanist:accompanist-systemuicontroller:0.24.7-alpha"
|
||||||
implementation "com.google.accompanist:accompanist-insets:0.24.3-alpha"
|
implementation "com.google.accompanist:accompanist-insets:0.24.7-alpha"
|
||||||
implementation "com.google.accompanist:accompanist-drawablepainter:0.24.3-alpha"
|
implementation "com.google.accompanist:accompanist-drawablepainter:0.24.7-alpha"
|
||||||
|
implementation "com.google.accompanist:accompanist-navigation-material:0.24.7-alpha"
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
implementation "androidx.navigation:navigation-compose:2.4.2"
|
implementation "androidx.navigation:navigation-compose:2.4.2"
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import androidx.compose.material.Surface
|
||||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import com.google.accompanist.insets.ProvideWindowInsets
|
import com.google.accompanist.insets.ProvideWindowInsets
|
||||||
|
import com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi
|
||||||
import com.google.accompanist.systemuicontroller.SystemUiController
|
import com.google.accompanist.systemuicontroller.SystemUiController
|
||||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||||
import com.pixelized.biblib.ui.composable.SystemThemeColor
|
import com.pixelized.biblib.ui.composable.SystemThemeColor
|
||||||
|
|
@ -24,6 +25,7 @@ class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
private val launcherViewModel: LauncherViewModel by viewModels()
|
private val launcherViewModel: LauncherViewModel by viewModels()
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterialNavigationApi::class)
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import androidx.navigation.NavHostController
|
||||||
import androidx.navigation.compose.NavHost
|
import androidx.navigation.compose.NavHost
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
|
import com.google.accompanist.navigation.material.*
|
||||||
import com.pixelized.biblib.ui.screen.authentication.AuthenticationScreen
|
import com.pixelized.biblib.ui.screen.authentication.AuthenticationScreen
|
||||||
import com.pixelized.biblib.ui.screen.detail.DetailScreen
|
import com.pixelized.biblib.ui.screen.detail.DetailScreen
|
||||||
import com.pixelized.biblib.ui.screen.home.HomeScreen
|
import com.pixelized.biblib.ui.screen.home.HomeScreen
|
||||||
|
|
@ -16,29 +17,33 @@ val LocalScreenNavHostController = compositionLocalOf<NavHostController> {
|
||||||
error("LocalFullScreenNavHostController is not ready yet.")
|
error("LocalFullScreenNavHostController is not ready yet.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterialNavigationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun ScreenNavHost(
|
fun ScreenNavHost(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
navHostController: NavHostController = rememberNavController(),
|
bottomSheetNavigator: BottomSheetNavigator = rememberBottomSheetNavigator(),
|
||||||
|
navHostController: NavHostController = rememberNavController(bottomSheetNavigator),
|
||||||
startDestination: Screen = Screen.Authentication
|
startDestination: Screen = Screen.Authentication
|
||||||
) {
|
) {
|
||||||
CompositionLocalProvider(LocalScreenNavHostController provides navHostController) {
|
CompositionLocalProvider(LocalScreenNavHostController provides navHostController) {
|
||||||
NavHost(
|
ModalBottomSheetLayout(bottomSheetNavigator) {
|
||||||
modifier = modifier,
|
NavHost(
|
||||||
navController = navHostController,
|
modifier = modifier,
|
||||||
startDestination = startDestination.route,
|
navController = navHostController,
|
||||||
) {
|
startDestination = startDestination.route,
|
||||||
composable(Screen.Authentication.route) {
|
|
||||||
AuthenticationScreen()
|
|
||||||
}
|
|
||||||
composable(Screen.Home.route) {
|
|
||||||
HomeScreen()
|
|
||||||
}
|
|
||||||
composable(
|
|
||||||
route = Screen.BookDetail.route,
|
|
||||||
arguments = Screen.BookDetail.arguments,
|
|
||||||
) {
|
) {
|
||||||
DetailScreen()
|
composable(Screen.Authentication.route) {
|
||||||
|
AuthenticationScreen()
|
||||||
|
}
|
||||||
|
composable(Screen.Home.route) {
|
||||||
|
HomeScreen()
|
||||||
|
}
|
||||||
|
bottomSheet(
|
||||||
|
route = Screen.BookDetail.route,
|
||||||
|
arguments = Screen.BookDetail.arguments,
|
||||||
|
) {
|
||||||
|
DetailScreen()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,13 +59,12 @@ private fun DetailScreenContent(
|
||||||
.systemBarsPadding()
|
.systemBarsPadding()
|
||||||
.padding(horizontal = 16.dp)
|
.padding(horizontal = 16.dp)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
AnimatedOffset(
|
AnimatedOffset(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(16.dp)
|
.padding(16.dp)
|
||||||
.align(Alignment.CenterHorizontally),
|
.align(Alignment.CenterHorizontally),
|
||||||
) {
|
) {
|
||||||
Card(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(200.dp, 320.dp)
|
.size(200.dp, 320.dp)
|
||||||
.background(MaterialTheme.colors.surface),
|
.background(MaterialTheme.colors.surface),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue