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 com.google.accompanist.pager.ExperimentalPagerApi
import me.ash.reader.data.entity.Filter import me.ash.reader.data.entity.Filter
import me.ash.reader.ui.ext.getName import me.ash.reader.ui.ext.getName
import me.ash.reader.ui.theme.palette.alwaysLight
@OptIn(ExperimentalPagerApi::class) @OptIn(ExperimentalPagerApi::class)
@Composable @Composable
@ -23,7 +22,7 @@ fun FilterBar(
val view = LocalView.current val view = LocalView.current
Box( Box(
modifier = Modifier.height(60.dp) // modifier = Modifier.height(60.dp)
) { ) {
Divider( Divider(
modifier = Modifier modifier = Modifier
@ -33,8 +32,8 @@ fun FilterBar(
color = MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.24f) color = MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.24f)
) )
NavigationBar( NavigationBar(
modifier = Modifier.fillMaxSize(), // modifier = Modifier.fillMaxSize(),
tonalElevation = 0.dp, // tonalElevation = 0.dp,
) { ) {
Spacer(modifier = Modifier.width(60.dp)) Spacer(modifier = Modifier.width(60.dp))
listOf( listOf(
@ -49,6 +48,7 @@ fun FilterBar(
contentDescription = item.getName() contentDescription = item.getName()
) )
}, },
label = { Text(text = item.getName(), style = MaterialTheme.typography.labelMedium) },
selected = filter == item, selected = filter == item,
onClick = { onClick = {
// view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP) // view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP)
@ -56,11 +56,11 @@ fun FilterBar(
filterOnClick(item) filterOnClick(item)
}, },
colors = NavigationBarItemDefaults.colors( colors = NavigationBarItemDefaults.colors(
selectedIconColor = MaterialTheme.colorScheme.onSecondaryContainer alwaysLight true, // selectedIconColor = MaterialTheme.colorScheme.onSecondaryContainer alwaysLight true,
// unselectedIconColor = MaterialTheme.colorScheme.outline, // unselectedIconColor = MaterialTheme.colorScheme.outline,
selectedTextColor = MaterialTheme.colorScheme.onSurface alwaysLight true, // selectedTextColor = MaterialTheme.colorScheme.onSurface alwaysLight true,
// unselectedTextColor = MaterialTheme.colorScheme.onSurfaceVariant, // 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.ArrowBack
import androidx.compose.material.icons.rounded.DoneAll import androidx.compose.material.icons.rounded.DoneAll
import androidx.compose.material.icons.rounded.Search import androidx.compose.material.icons.rounded.Search
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.*
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.runtime.* import androidx.compose.runtime.*
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester 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.component.SwipeRefresh
import me.ash.reader.ui.ext.collectAsStateValue import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.getName 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.common.RouteName
import me.ash.reader.ui.page.home.FilterBar import me.ash.reader.ui.page.home.FilterBar
import me.ash.reader.ui.page.home.FilterState import me.ash.reader.ui.page.home.FilterState
@ -100,12 +98,16 @@ fun FlowPage(
Scaffold( Scaffold(
modifier = Modifier modifier = Modifier
.background(MaterialTheme.colorScheme.surface) .background(MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp))
.statusBarsPadding() .statusBarsPadding()
.navigationBarsPadding(), .navigationBarsPadding(),
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp),
topBar = { topBar = {
SmallTopAppBar( SmallTopAppBar(
title = {}, title = {},
colors = TopAppBarDefaults.smallTopAppBarColors(
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp),
),
navigationIcon = { navigationIcon = {
FeedbackIconButton( FeedbackIconButton(
imageVector = Icons.Rounded.ArrowBack, imageVector = Icons.Rounded.ArrowBack,

View File

@ -10,13 +10,14 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import me.ash.reader.ui.ext.surfaceColorAtElevation
@Composable @Composable
fun StickyHeader(currentItemDay: String) { fun StickyHeader(currentItemDay: String) {
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.background(MaterialTheme.colorScheme.surface), .background(MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp)),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Text( Text(