Add more styles for navigation bar and tonal elevation available

This commit is contained in:
Ash 2022-04-30 17:37:06 +08:00
parent eb679db4ed
commit 15b6db52a7
3 changed files with 16 additions and 13 deletions

View File

@ -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,
)
)
}

View File

@ -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,

View File

@ -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(