From 15b6db52a77d8c2b9790898848a4b99dee518b50 Mon Sep 17 00:00:00 2001 From: Ash Date: Sat, 30 Apr 2022 17:37:06 +0800 Subject: [PATCH] Add more styles for navigation bar and tonal elevation available --- .../java/me/ash/reader/ui/page/home/FilterBar.kt | 14 +++++++------- .../me/ash/reader/ui/page/home/flow/FlowPage.kt | 12 +++++++----- .../ash/reader/ui/page/home/flow/StickyHeader.kt | 3 ++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/me/ash/reader/ui/page/home/FilterBar.kt b/app/src/main/java/me/ash/reader/ui/page/home/FilterBar.kt index a2f217d..ab3cbb0 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/FilterBar.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/FilterBar.kt @@ -11,7 +11,6 @@ import androidx.compose.ui.zIndex import com.google.accompanist.pager.ExperimentalPagerApi import me.ash.reader.data.entity.Filter import me.ash.reader.ui.ext.getName -import me.ash.reader.ui.theme.palette.alwaysLight @OptIn(ExperimentalPagerApi::class) @Composable @@ -23,7 +22,7 @@ fun FilterBar( val view = LocalView.current Box( - modifier = Modifier.height(60.dp) +// modifier = Modifier.height(60.dp) ) { Divider( modifier = Modifier @@ -33,8 +32,8 @@ fun FilterBar( color = MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.24f) ) NavigationBar( - modifier = Modifier.fillMaxSize(), - tonalElevation = 0.dp, +// modifier = Modifier.fillMaxSize(), +// tonalElevation = 0.dp, ) { Spacer(modifier = Modifier.width(60.dp)) listOf( @@ -49,6 +48,7 @@ fun FilterBar( contentDescription = item.getName() ) }, + label = { Text(text = item.getName(), style = MaterialTheme.typography.labelMedium) }, selected = filter == item, onClick = { // view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP) @@ -56,11 +56,11 @@ fun FilterBar( filterOnClick(item) }, colors = NavigationBarItemDefaults.colors( - selectedIconColor = MaterialTheme.colorScheme.onSecondaryContainer alwaysLight true, +// selectedIconColor = MaterialTheme.colorScheme.onSecondaryContainer alwaysLight true, // unselectedIconColor = MaterialTheme.colorScheme.outline, - selectedTextColor = MaterialTheme.colorScheme.onSurface alwaysLight true, +// selectedTextColor = MaterialTheme.colorScheme.onSurface alwaysLight true, // unselectedTextColor = MaterialTheme.colorScheme.onSurfaceVariant, - indicatorColor = MaterialTheme.colorScheme.primaryContainer alwaysLight true, +// indicatorColor = MaterialTheme.colorScheme.primaryContainer alwaysLight true, ) ) } diff --git a/app/src/main/java/me/ash/reader/ui/page/home/flow/FlowPage.kt b/app/src/main/java/me/ash/reader/ui/page/home/flow/FlowPage.kt index c036717..80dcf20 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/flow/FlowPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/flow/FlowPage.kt @@ -11,10 +11,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material.icons.rounded.DoneAll import androidx.compose.material.icons.rounded.Search -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.Scaffold -import androidx.compose.material3.SmallTopAppBar +import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester @@ -35,6 +32,7 @@ import me.ash.reader.ui.component.FeedbackIconButton import me.ash.reader.ui.component.SwipeRefresh import me.ash.reader.ui.ext.collectAsStateValue import me.ash.reader.ui.ext.getName +import me.ash.reader.ui.ext.surfaceColorAtElevation import me.ash.reader.ui.page.common.RouteName import me.ash.reader.ui.page.home.FilterBar import me.ash.reader.ui.page.home.FilterState @@ -100,12 +98,16 @@ fun FlowPage( Scaffold( modifier = Modifier - .background(MaterialTheme.colorScheme.surface) + .background(MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp)) .statusBarsPadding() .navigationBarsPadding(), + containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp), topBar = { SmallTopAppBar( title = {}, + colors = TopAppBarDefaults.smallTopAppBarColors( + containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp), + ), navigationIcon = { FeedbackIconButton( imageVector = Icons.Rounded.ArrowBack, diff --git a/app/src/main/java/me/ash/reader/ui/page/home/flow/StickyHeader.kt b/app/src/main/java/me/ash/reader/ui/page/home/flow/StickyHeader.kt index 0ef4020..b2ef0e3 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/flow/StickyHeader.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/flow/StickyHeader.kt @@ -10,13 +10,14 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import me.ash.reader.ui.ext.surfaceColorAtElevation @Composable fun StickyHeader(currentItemDay: String) { Row( modifier = Modifier .fillMaxWidth() - .background(MaterialTheme.colorScheme.surface), + .background(MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp)), verticalAlignment = Alignment.CenterVertically ) { Text(